# mathr / blog / #

## JACK on top of Pulseaudio

While evaluating whether to dive in and get a Bela single board computer for low latency processing of external inputs, that I would want to livecode in the C programming language using my clive system, I found that my initial attempts at cross-compiling into a network-shared folder were doomed, because my host system was running Debian Buster (current Testing, next Stable) and my device system (a Raspberry Pi Model 3 B) was running Raspbian Jessie (current OldStable). Jessie has an ancient glibc, the basic libraries that let C programs and libraries work, and my cross-compiled code needed a newer version.

So I installed Debian Buster arm64 from unofficial unsupported sources. After upgrading the system to my liking, I tried the audio through HDMI. The aplay command could make some noise, but it was using a Pulseaudio backend. Try as I might I couldn't get a raw ALSA backend to make any sound, especially not with JACK (which output errors about not supported hardware sample types). So I resorted to radical means. I set up a JACK server using the dummy backend, and hooked Pulseaudio to it with pulseaudio-module-jack. Then adding a loopback Pulseaudio device to route the JACK sources/sinks to the hardware:

$/usr/bin/jackd -ddummy &$ tail /etc/pulse/default.pa
$mplayer -ao jack somefile.ogg -loop 0 &$ jack_connect "MPlayer [15406]:out_0" "PulseAudio JACK Source:front-left"
\$ jack_connect "MPlayer [15406]:out_1" "PulseAudio JACK Source:front-right"