The following steps, coupled with a Raspberry Pi 4 and Patchbox OS, will produce a configuration where Jack audio plays back through bluetooth (e.g. speaker or headphones) instead of the headphone output or other audio device.
1. Install Patchbox OS version 112320 image (on Raspberry Pi 4)
2. SSH to Patchbox and complete Patchbox setup.
a. If ethernet/internet is available, accept prompt to update.
b. For audio device, use onboard sound (headphones) with settings: 44100, 512, 3.
c. Choose a module: ânone: default patchbox OS envioronmentâ
d. Complete Patchbox setup.
3. Update repositories and raspberry pi files.
a. sudo apt update
b. sudo apt upgrade
4. Remove onboard audio conflict by editing /boot/config.txt.
sudo nano /boot/config.txt
a. Comment out onboard audio:
#dtparam=audio=on
5. Delay Jack until Bluetooth connected by editing Jack Service
a. Make copy of jack.service to /etc
sudo cp /lib/systemd/system/jack.service /etc/systemd/system/jack.service
b. Edit jack.service
sudo nano /etc/systemd/system/jack.service
c. Add line above ExecStart
ExecStartPre=/bin/sleep 15
15 worked for me - the number of seconds may depend on the reliable pairing time for your BT speaker/headphone.
d. Refresh services and restart jack
sudo systemctl daemon-reload
sudo systemctl restart jack
6. Update jack startup parameters to use bluetooth
a. Edit jackdrc
sudo nano /etc/jackdrc
b. Comment out (#) existing execution line for reference
c. Add new jack startup line, with destination bluealsa (bluetooth)
exec /usr/bin/jackd -r -d alsa -P bluealsa -n 3 -S -o 2 -X seq
7. Create /etc/asound.conf
a. Create file
sudo nano /etc/asound.conf
b. Add contents:
If you donât know your Bluetooth Device address (bluealsa.deviceâŚXX:XX etc) yet, itâs ok to do step 8 first!
defaults.bluealsa.interface "hci0"
defaults.bluealsa.service "org.bluealsa"
defaults.bluealsa.device "XX:XX:XX:XX:XX:XX"
defaults.bluealsa.profile "a2dp"
defaults.bluealsa.delay 10000
pcm.!default {
type asym
playback.pcm {
type plug
slave.pcm "output"
}
capture.pcm {
type plug
slave.pcm "input"
}
}
pcm.output {
type bluealsa
device "XX:XX:XX:XX:XX:XX"
profile "a2dp"
}
ctl.!default {
type bluealsa
}
8. Connect to your bluetooth audio playback device.
a. Turn on BT device and activate pairing before entering these commands.
bluetoothctl
power on
agent on
default-agent
scan on (Identify your bluetooth device address)
(Replace any XX in this guide with your bluetooth device address)
pair XX:XX:XX:XX:XX:XX
trust XX:XX:XX:XX:XX:XX
connect XX:XX:XX:XX:XX:XX
9. Ensure BT device connects at boot time:
a. Edit rc.local
sudo nano /etc/rc.local
i. Add, right before Exit 0 line:
echo âconnect XX:XX:XX:XX:XX:XX \nquitâ | bluetoothctl
10. Address SAP and Privacy errors.
a. Edit bluetooth service.
sudo nano /lib/systemd/system/bluetooth.service
Add --noplugin=sap to ExecStart:
ExecStart=/usr/lib/bluetooth/bluetoothd --noplugin=sap
b. Edit bthelper service.
sudo nano /lib/systemd/system/bthelper@.service
Replace contents with:
[Unit]
Description=Raspberry Pi bluetooth helper
Requires=bluetooth.service
After=bluetooth.service
[Service]
Type=simple
ExecStartPre=/bin/sleep 2
ExecStart=/usr/bin/bthelper %I
The âsleep 2â is a delay to help with connection timing.
11. Reboot and Verify Jack Startup.
a. Check Jack Service
sudo systemctl status jack
b. A successful result includes Jack with a green active status, like:
Now Jack should be operational, with audio playing over bluetooth! For my setup, the next steps include installing the KXStudio repository, Carla, Helm, and ZynAddSubFx. I use Carla to connect incoming midi with LV2 instrument plugs and direct them to the outputs. If you try Carla with Jack as the engine, I recommend using the âPatchbayâ configuration to wire the correct MIDI, audio playback, and plug-ins, together. It works!