PiFmAdv
PiFmAdv copied to clipboard
[Guide] Use MP3 natively without sox
Since libsndfile1-dev
version 1.1.0 supports MP3 (http://libsndfile.github.io/libsndfile/#history), we can update that library to support MP3 playback via PiFmAdv. However, this version is not supported in current Raspbian (Bullseye). Fortunately, we can use Raspbian Bookworm repo.
-
Update your RPi (optional, but recommended).
sudo bash -c 'for i in update {,dist-}upgrade auto{remove,clean}; do apt-get $i -y; done'
-
Edit
/etc/apt/sources.list
file using your favourite editor, for examplesudo vim /etc/apt/sources.list
. In my case, the file looks like this:
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
Replace bullseye
with bookworm
.
deb http://raspbian.raspberrypi.org/raspbian/ bookworm main contrib non-free rpi
- Run
sudo apt update
. It wil say that 69420 packages can be updated - ignore that. - Run
sudo apt install libsndfile1-dev
. It will update only this package and its dependencies. - Confirm that
libsndfile1-dev
is now version 1.1.0 or later. Runsudo apt-cache policy libsndfile1-dev
. My output:
libsndfile1-dev:
Installed: 1.1.0-2
(...)
- Repeat step 1, but now revert
bookworm
tobullseye
.
Congratulations, now you can use MP3 files with PiFmAdv without using sox! 🎉