Jack Audio
Jack Audio | |
Homepage | https://jackaudio.org/ |
---|---|
Documentation | https://jackaudio.org/api/ |
Repository | https://github.com/jackaudio/jack2 |
Jack Audio is a realtime audio server that Autopilot uses to play sounds. Jack operates a daemon (jackd) in the background, and Autopilot interacts to it through Jack-CLIENT.
Installation
Jack has a few longstanding issues working on the Raspberry Pi, the most pressing of which seems to be the use of DBus in the standard binary distributed by the raspberry pi apt repos which is unavailable in eg. a headless context (where an X library is not running).
Installation can be done with apt, but it is recommended that you compile it from source. Both options are available as autopilot scripts (jackd_source and jackd_apt)
From Source
Clone and build the library, enabling support for ALSA and building with 6 processes. Then install the library and refresh symbolic links
git clone git://github.com/jackaudio/jack2 --depth 1 cd jack2 ./waf configure --alsa=yes --libdir=/usr/lib/arm-linux-gnueabihf/ ./waf build -j6 sudo ./waf install" sudo ldconfig
This will install jack audio to /usr/local/lib and /usr/local/bin/
From Apt
If installing from apt, use
sudo apt update && sudo apt install -y jackd2
If installed with apt and you receive an exception that includes the following[1]:
Failed to connect to session bus for device reservation: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Then prevent jackd from reserving the audio device, which may cause skipping/buffer under-runs if another process attempts to access the audio device. (You may want to add this to your .bash_profile if you don't want to declare it every time)
export JACK_NO_AUDIO_RESERVATION=1
Configuration
After jack is installed, I recommend enabling the @audio group access to launching jackd at realtime priority and increasing the amount of memory that it is able to lock
sudo sh -c "echo @audio - memlock 256000 >> /etc/security/limits.conf" sudo sh -c "echo @audio - rtprio 75 >> /etc/security/limits.conf"
Audio
https://docs.auto-pi-lot.com/en/latest/autopilot.stim.sound.jackclient.html