Bluetooth source to jack sink?

Continuing the discussion from Bluetooth Audio In:

The configuration in the referenced post works in that it runs without error but it doesn’t provide any way to pair a Bluetooth source to send audio to the virtual ALSA sink. The difference is I added the ALSA configuration to /etc/alsa/conf.d/50-jack.conf since I’m running PatchboxOS with a Pisound board attached.

Using the internal Bluetooth radio and these instructions from the RaspberryPi forums I was able to put the RPi into discoverable mode, pairing mode and view the hostname (patchbox) on my Android mobile device but trying to pair the device fails and outputs nothing on either end.

The most information I have is that “internal Bluetooth isn’t good” but I don’t really know what that means, other then it also seems to silently fail on my hardware.

Ideally, I’d like a high-latency sink that I can receive a stereo audio stream from any Bluetooth source. I would like it to be patchable in the JACK graph like the Pulseaudio jack sink. Basically it would operate similarly to how Chromium can be part of the JACK graph via the two pulse sinks, named this on my system.

PulseAudio JACK Sink:front-left
PulseAudio JACK Sink:front-right

Experimenting with some things and will update this thread if there’s any progress…

Disabling any customization to /etc/bluetooth/main.conf, turning off wifi and connecting via Ethernet results in the PiSound mobile app connecting via Bluetooth first try, though I don’t think this uses an A2DP profile.

The RPi interactive Bluetooth shell detects my phone when it’s connected via the PiSound app (but not the Android Bluetooth settings menu) and says the device can act as an Audio source. Output looking good…

[Pixel 4a]# info 88:54:1F:4D:4E:81
Device 88:54:1F:4D:4E:81 (public)
        Name: Pixel 4a
        Alias: Pixel 4a
        Class: 0x005a020c
        Icon: phone
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)
        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
        UUID: PANU                      (00001115-0000-1000-8000-00805f9b34fb)
        UUID: NAP                       (00001116-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
        UUID: SIM Access                (0000112d-0000-1000-8000-00805f9b34fb)
        UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)
        UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (931c7e8a-540f-4686-b798-e8df0a2ad9f7)
        UUID: Vendor specific           (d037930c-e691-4e9c-b51b-2e71d016d812)
        Modalias: bluetooth:v00E0p1200d1436

But playing audio from the Pixel 4a doesn’t recognize the paired device as an audio endpoint.

Flashed a second SD card with the current Raspbian (which is running Pipewire by default!) and now the RPi shows up as an audio device in Android. Unfortunately, the same pairing problem as PatchboxOS happens where the Android Bluetooth menu silently fails to pair after tapping the device name.

Seems like this is some kind of bluetooth authentication problem. On the RPi, the output of bluetoothd also looks like there’s both a source and a sink for A2DP, which looks ideal.

Apr 05 02:30:04 raspberrypi systemd[1]: Starting Bluetooth service...
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: Bluetooth daemon 5.55
Apr 05 02:30:04 raspberrypi systemd[1]: Started Bluetooth service.
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: Starting SDP server
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: Bluetooth management interface 1.18 initialized
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: profiles/sap/server.c:sap_server_register() Sap driver initialization failed.
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: sap-server: Operation not permitted (1)
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: Failed to set privacy: Rejected (0x0b)
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: Endpoint registered: sender=:1.26 path=/MediaEndpoint/A2DPSink/sbc
Apr 05 02:30:04 raspberrypi bluetoothd[1824]: Endpoint registered: sender=:1.26 path=/MediaEndpoint/A2DPSource/sbc

Perhaps the line about failing to set privacy is the problem?

Update! I was able to play sound from my phone on Rasbpian 11 through the built-in sound card, though there’s too small of a buffer so there is a regular audio drop out. I had to pair from the RPi to the phone and accept a PIN on the phone screen. PatchboxOS still can’t pair with my phone as an audio device, I suspect due to some configuration outside of bluetooth that is used for the mobile app.

Update! I was able to pair to both a speaker and headphones and play sound with the debian bluetooth pairing documentation. This is the opposite of what I wanted but at least it is progress!

I’m gonna leave this here since it seems like the problem is some configuration in PatchboxOS. I’m moving on to use Raspbian 11 with the Pisound board which works by default as a Pulseaudio device.