REST service for multichannel audio on demand from Raspberry Pi. Made with ❤️ for makers, DIY craftsmen, and professional soundstage designers everywhere
fxaudio uses mpg123 under the hood to play audio, so you'll need to make sure it's installed first. Lucky for you, installation is really simple:
sudo apt-get update
sudo apt-get install -y mpg123
Make sure that you have a stock Raspberry Pi installation and make sure you have configured HDMI in your /boot/config.txt. Also: Buster might be a good legacy distro to start with.
I would recommend using the Adafruit Speaker Bonnet for Raspberry Pi as well -- just get a Pi with headers and slide the bonnet right down on top of it (and be sure to follow the Raspberry Pi OS configuration instructions for the board). I used a pair of 8 ohm 3" speakers with the bonnet.
Run speaker-test -c2
to generate white noise out of the speaker, alternating left and right.
You can do a test with streaming music using mpg123 http://ice1.somafm.com/u80s-128-mp3
Installing fxaudio is also really simple. Grab the .deb file from the latest release and then install it using dpkg:
sudo dpkg -i fxaudio-1.0.40_armhf.deb
This automatically installs the fxaudio service with a default configuration and starts the service.
You can then use the service at http://localhost:3030
See the REST API documentation at http://localhost:3030/swagger/
Uninstalling is just as simple:
sudo dpkg -r fxaudio
This is most likely your HDMI audio system doing something it shouldn't. You can work around this by enabling a service to play 'no audio' all the time in the background. This will keep the device ready for when you want to play some actual audio through it.
Put the following in /etc/systemd/system/aplay.service
[Unit]
Description=Invoke aplay from /dev/zero at system start.
[Service]
ExecStart=/usr/bin/aplay -D default -t raw -r 44100 -c 2 -f S16_LE /dev/zero
[Install]
WantedBy=multi-user.target
Then run the following commands to register the service, enable it, and start it:
sudo systemctl daemon-reload
sudo systemctl enable aplay
sudo systemctl start aplay