Sonic-pi on RPI4 and bluetooth

Set up my RPI4 to link to a Bluetooth speaker. Sounds from other sources, like web browser, work fine, but sound from Sonic-Pi is only available through the Pi’s headphone jack. I searched online for this as a known issue but no luck, and I chose to post here rather than the RPI forums as the issue seems specific to the software. Is it not possible to tweak a setting to have Sonic-Pi sound output also heard through the Bluetooth speaker? Many thanks.

Are you connecting the speaker before or after starting up Sonic Pi? Once it’s running, Sonic Pi doesn’t reload the audio settings, so adding speakers after that isn’t going to work.

Thanks - I tried both scenarios - in each case the result is the same.

The problem is that Sonic Pi on a Raspberry Pi uses jackd for audio connections, and bluetooth devices will not show up as available connections for this. There is a github project https://github.com/Arkq/bluez-alsa which MIGHT be of use in allowing this to happen. It would take a bit of work, but could be worth investigating.
I have a bluetooth speaker, but I connect it by cable when I want to use it with my RPi and Sonic Pi :slight_smile:

Many thanks - will give this a go.

I met the same problem, and the solution in github seems good but doesn’t work out. Error report after I typed in the first line to install.

Here I found a very excellent solution. And now my sonic pi works very well on RPI4 with bluetooth speaker.

Hi @zike

behind this solution the same mentor : @robin.newman aka rbnpi :slight_smile:

1 Like

Hi there !

So as usual @robin saves my life with that tip :slight_smile:

Now i can use my Bluetooth speaker UE BOOM 2 with Sonic Pi on the latest Raspberry OS (released on 2020-12-02).
So a little (yellow) summary (fab4 joke)

Note that i’ve installed this version of Raspberry Os : https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2020-12-04/2020-12-02-raspios-buster-armhf.zip. Flash the img on a sd card then insert into your raspberry pi.

Then install the Robin package for raspberrypi OS available on the official website https://sonic-pi.net/files/releases/v3.2.2/sonic-pi_3.2.2_4_armhf.deb

Then follow the instructions given by @robin.newman :

sudo apt install pulseaudio-module-jack
wget https://gist.githubusercontent.com/rbnpi/8812203f5c9a995620bed9ce3a3c6a20/raw/30da158af589a011bafc26c9d19ad007a68d58ca/scsynthexternal.rb
sudo mv /opt/sonic-pi/app/server/ruby/lib/sonicpi/scsynthexternal.rb /opt/sonic-pi/app/server/ruby/lib/sonicpi/scsynthexternal.rb.bak
sudo cp scsynthexternal.rb /opt/sonic-pi/app/server/ruby/https://downloads.raspberrypi.org/raspios_armhf/images/raspios_armhf-2020-12-04/2020-12-02-raspios-buster-armhf.ziplib/sonicpi/scsynthexternal.rb
sonic-pi

Cheers

For completeness I assume you nstalled sp3.3.2 on top of the OS although this may work with the supplied 3.1 version but I haven’t tried that

Edit 19/12/2020 : Yes I have installed your package sonic-pi_3.2.2_4_armhf.deb (not the spi 3.3.2. you mentionned).

Sorry I meant 3.2.2_4

1 Like