The aim of this project is to build a headless parametric audio equaliser. This is a DIY version of what can be achieved with a MiniDSP type device.
Hardware:
- a Raspberry Pi (starting from a Model B)
- an external USB sound card
Build example with a Behringer UCA-202 audio interface
Specifications:
- Device accepts a line-in audio signal and outputs a line-out audio signal
- Typically sits between a pre-amp and amplifier, or between a TV line-out and a mini speaker
- Latency less than 40 ms (1 video frame at 25 fps) on Raspberry pi model B, 2 channels at 48kHz
- Headless operation. Configured via text files (no graphic user interface).
- Parametric EQ uses parameters from Room EQ Wizard acoustics software
- Equaliser starts automatically after boot.
I am assuming that you are familiar with Linux and the Linux command-line.
- Install RPI OS Lite 32 bits using the Debian/Ubuntu imager
- Configure ssh, wifi, etc with the imager
- Unmount and remount the card. Resize (expand)
/root
partition withgparted
- ssh login will be
ssh pi@raspberrypi.local
bmc0/dsp provides dsp functions with low CPU requirements that can works with pulseaudio and alsa. I will be using alsa to fit the CPU capabilites of a Raspberry Pi model B.
Follow the build instructions from System Wide DSP Guide
sudo apt-get install ladspa-sdk
git clone https://github.com/bmc0/dsp.git
cd dsp
./configure --disable-dsp --disable-fftw3 --disable-zita-convolver
make
sudo make install
find the name of your external sound card with:
aplay -L
configure /etc/asound.conf
. In this example the card is hw:CARD=CODEC
.
pcm.dsp {
type plug
slave {
format FLOAT
rate unchanged
channels 2
pcm {
type ladspa
path "/usr/lib/ladspa"
playback_plugins [{
label "ladspa_dsp"
}]
slave.pcm {
type plug
slave {
pcm "hw:CARD=CODEC"
rate unchanged
channels unchanged
}
}
}
}
}
Then create the file /etc/ladspa_dsp/config
for the equaliser settings.
This is an extreme example for test purposes:
effects_chain=highpass 300 1.0 highpass 300 1.0 lowpass 3500 1.0 lowpass 3500 1.0
Test effect on playback:
aplay -D dsp my_test_audio_file.wav
Test buffer overrun, latency, cpu load. Connect an audio signal to the inputs of the soundcard.
alsaloop -C hw:CARD=CODEC -P dsp -t 40000 --sync=1 -v
Add those instructions to your /etc/rc.local
.
# play startup sound (optional)
aplay -D plughw:CARD=CODEC /home/pi/blip.wav
# run ladspa_dsp. Note: ladspa_dsp doesn't run from root
(sleep 18; su pi -c 'alsaloop -C hw:CARD=CODEC -P dsp -t 50000 --sync=1') &
Notes:
ladspa_dsp
doesn't run from the root user- If
pulseaudio
is installed, uninstall or disablepulseaudio
- The
sleep
delay is required on a Model B to startalsaloop
after completion of the boot process. - If latency is not an issue, you can reduce the
sleep
value, you will get around 0.5 sec latency
Image of build: