How to make PeppyMeter work

I love VU meters. Then again, who doesn't? There is something mesmerizing about the needle or LED segments dancing to the rhythm of the music. So when I stumbled upon PeppyMeter, I knew right away that I must have it running on my machine. Making it work turned out to be a non-trivial matter, but I managed to get it up and running after much experimenting. And I've documented all the steps for your convenience. The following procedure assumes that you're using Ubuntu or Linux Mint.

Install the required packages:

sudo apt install python3-pygame

Clone the PeppyMeter Git repository and switch to the resulting directory:

git clone https://github.com/project-owner/PeppyMeter.git
cd PeppyMeter

Open the config.txt for editing and replace the default path in pipe.name = /home/pi/myfifo with the correct one, for example: /home/dmpop/myfifo

Save the changes, open the terminal and run the mkfifo myfifo command.

Install the peppyalsa driver using the following commands:

sudo apt install build-essential autoconf automake libtool libasound2-dev libfftw3-dev
git clone https://github.com/project-owner/peppyalsa.git
cd peppyalsa
aclocal && libtoolize
autoconf && automake --add-missing
./configure && make
sudo make install

Create the ~/.asoundrc file, open it for editing, and paste the following configuration:

pcm.!default {
        type plug
        slave.pcm "softvol_and_peppyalsa"
}

ctl.!default {
        type hw
        card 0
}

pcm.peppyalsa {
        type meter
        slave.pcm "hw:0,0"
        scopes.0 peppyalsa
}

pcm.softvol_and_peppyalsa {
        type softvol
        slave.pcm "peppyalsa"
        control {
                name "PCM"
                card 0
        }
}

pcm_scope.peppyalsa {
        type peppyalsa
        decay_ms 400
        meter "/home/pi/myfifo"
        meter_max 100
        meter_show 0
        spectrum "/home/pi/myfifosa"
        spectrum_max 100
        spectrum_size 30
}

pcm_scope_type.peppyalsa {
        lib /usr/local/lib/libpeppyalsa.so
}

pcm.dsp0 peppyalsa

Replace all occurrences of /home/pi with the correct path, save the changes, and reboot the machine.

Start PeppyMeter:

cd PeppyMeter
python3 peppymeter.py

If you use VLC, open the desired file or URL using the following command:

vlc --aout=alsa --alsa-audio-device=peppyalsa [FILE or URL]

Resources: