No sound in sonic pi

I can play sound via A/V port (instead of HDMI) with my raspberry pi (for example, the firefox browser can have sound when play videos). But sonic pi can not play sound. Does anybody know how to fix the problem? Thanks.

@wZoWt1CO6i - weā€™ll need a few more details.

  • what Operating System (and version of this) are you using on your RPi?
  • what version of Sonic Pi?

Here is it.

$ cat /etc/issue
Raspbian GNU/Linux 10 \n \l

Sonic Pi version 3.1.0 - ā€˜Saunaā€™

Thanks.

First of all, we strongly recommend that you upgrade Sonic Pi. Version 3.1 is now very old, and is also an incomplete version that only partially works - it was built outside of our control by the RPi foundation. See https://sonic-pi.net/ or Releases Ā· sonic-pi-net/sonic-pi Ā· GitHub for the latest version.

Secondly, Itā€™s possible youā€™re not using the latest release of Raspberry Pi OS, (since your output above says youā€™re using ā€˜Raspbianā€™), but if you do end up upgrading Buster, there are extra considerations to be aware of when using the latest version of Raspberry Pi OS, as they have switched to using the software called PulseAudio as their default sound server. There are discussions around this here:

To update the OS, should I follow this. Is it too old to follow?

EDIT: I got this. What should I do?

$ sudo rpi-update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Performing self-update
*** Relaunching after update
*** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom
*** Weā€™re running for the first time
*** Backing up files (this will take a few minutes)
*** Backing up firmware
*** Backing up modules 5.4.79-v7l+
Partition size 255M may not be sufficient for new Pi4 files
This could result in a system that will not boot.
256M FAT partition is recommended. Ensure you have a backup if continuing.
Would you like to proceed? (y/N)

Admittedly, Iā€™m not a frequent Raspberry Pi user myself, but as far as I can tell, version 10 is Buster - so it should in theory not be a big breaking change to just update Buster. Happy for someone else who is a more regular RPi user to chime in if they can though!
Edit: Ah, just saw your extra comments. Sounds like you should ensure some extra free space somehow, Iā€™d definitely do that before trying to update the OS.

I run the following command. But I still see sonic pi 3.1. Why is it so? BTW, how to check sonic pi version from command line?

$ sudo apt install ./sonic-pi_3.2.2_4_armhf.deb

Also, what are the commands to ensure there is extra free space?

Recent versions of Sonic Pi are not distributed through the built in package repository at the moment, as it is currently too difficult to provide a package in the necessary format. However, @robin.newman has been very gracious in helping to provide a separate package available through our own official websites as noted above.

Re free space, itā€™s not immediately clear what you should do about that, without knowing a bit more about your situation:

  • what kind of storage medium are you using on the RPi? (I assume a standard SD card)
  • how much storage does your SD card provide overall?
  • have you done anything to specifically partition or limit the available storage?

Oh, sorry, didnā€™t quite notice you were already attempting to install a local package :sweat_smile:
Iā€™m not sure why youā€™re still seeing 3.1, as I thought 3.2.2_4 was intended to overwrite it.
All I can suggest for now is to perhaps uninstall 3.1, (worst case scenario, remove both 3.1 and 3.2.2_4, then install the recent one again).
Robin may have further comments when heā€™s around (or someone else with a better idea than me for that matter) :slight_smile:

Here is my filesystem. I used the builtin installer of a recently purchased Raspberry Pi 4B when I install raspian.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        27G  7.8G   18G  31% /
devtmpfs        3.8G     0  3.8G   0% /dev
tmpfs           3.9G   24M  3.9G   1% /dev/shm
tmpfs           3.9G  8.7M  3.9G   1% /run
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/mmcblk0p6  253M   46M  207M  18% /boot
tmpfs           788M  4.0K  788M   1% /run/user/1000

What should be the date of sonic-pi? I donā€™t know where the new version is installed. Why its date is not current?

$ sudo apt install ./sonic-pi_3.2.2_4_armhf.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'sonic-pi' instead of './sonic-pi_3.2.2_4_armhf.deb'
sonic-pi is already the newest version (4:3.2.2).
The following packages were automatically installed and are no longer required:
  libgit2-27 libhttp-parser2.8 libmbedcrypto3 libmbedtls12 libmbedx509-0 libqwt-qt5-6 ruby-activesupport ruby-afm ruby-ascii85 ruby-atomic ruby-coderay ruby-concurrent ruby-ffi ruby-hamster
  ruby-hashery ruby-i18n ruby-kramdown ruby-memoist ruby-multi-json ruby-oj ruby-pdf-core ruby-pdf-reader ruby-prawn ruby-prawn-table ruby-rc4 ruby-rouge ruby-rugged ruby-stringex
  ruby-thread-safe ruby-ttfunk ruby-tzinfo ruby-wavefile sonic-pi-samples sonic-pi-server
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$ ls -l /usr/bin/sonic-pi
-rwxr-xr-x 1 root root 37 Jun  2  2020 /usr/bin/sonic-pi

Hi

Maybe in this post Sonic-pi on RPI4 and bluetooth - #10 by nlb the steps are detailed.
By the way if you donā€™t have important data on your roi, I suggest to start from a fresh install via the latest raspberry Os img.

Aaah. Iā€™ve just done a bit more research - you actually donā€™t want to use rpi-update. This upgrades your OS kernel and video firmware to pre-release versions. This could leave your system in an unstable state!
(The warning about free space is because rpi-update makes use of the boot partition, which is different to the normal update).
If Iā€™m reading things correctly, it looks like what you want is sudo apt update && sudo apt full-upgrade. That one upgrades installed packages and their dependencies to their latest stable versions. (It does not perform an upgrade from one major version of the OS to another though, but you donā€™t need that in this case yet).
c.f:

June 2nd was the date that Robinā€™s 3.2.2_4 package was created.

Perhaps I could chip in here. First I would strongly advise using a fresh install of Raspberry Pi OS if you have a spare micro-sd card, or means of copying off any stuff you want to keep from your existing card. I have done sudo apt update && sudo apt full-upgrade but there can be some tweaks afterwards that may be necessary to get things going properly. Its worth looking at upgrade comments in this thread
However there is another important change with the latest OS in that it now bases the sound system on pulse audio. This is more convenient to allow the use of sound with a range of programs including Chromium browser and VLC, but unfortunately does not sit so comfortably with Sonic Pi, which uses Jack becuase that is the sound system utilised on linux by the scsynth synthesiser engine of SuperCollider which sonic pi uses.
The previous method that Sonic Pi used to selecti the sound output device was to read data from the file .asoundrc but with the new pulse audio setup this file is no longer utilised, and sonic pi 3.1 (still bundled with the OS) and my sonic pi 3.2.2 will both default to using HDMI as the sound output device.

I have worked on modifications to sonic pi 3.2.2 to enable it to utilise the new pulseaudio setup and to be able to select other sound devices such as a usb connected audio device and indeed over the weekend built a new .deb file for version 3.3.0-beta4 which seems to work fine, and hope to release a new .deb when version 3.3.0 is released hopefully within the next few weeks.

The basis of the changes can be applied to version 3.2.2 are here
Raspberry Pi, Pulse Audio Workaround with USB soundcard - #10 by robin.newman. This works quite well, although the latency will be inferior to just using jack directly.

One final thing. If you have installed sonic -pi with a .deb then you can find details using
dpkg -l | grep sonic-pi

you can list the installed files using
dpkg -L sonic-pi but this will give a long list so you may want to put it into a text file before examining eg
dpkg -L sonic-pi > spfiles.txt
and then inspect the resulting file spfiles.txt

my .deb file installs sonic pi in location /opt/sonic-pi

2 Likes

$ dpkg -l | grep sonic-pi
ii sonic-pi 4:3.2.2 armhf Sonic Pi - The Live Coding Music Synth for Everyone.
ii sonic-pi-samples 3.1.0~repack~test2-1 all Audio samples for Sonic Pi
ii sonic-pi-server 3.1.0~repack~test2-1 all Backend server for Sonic Pi

dpkg -L sonic-pi is indeed too long to be posted here.

So basically sudo apt update && sudo apt full-upgrade wonā€™t will not make sonic-pi sound work correctly for some reason. There is no way to figure exactly what configuration is wrong. The current solution is to perform a new install? My raspberry pi was purchased just at the end of last month, are your sure the OS was so old that I can cause the problem? I ask this because I am not sure what is the cause of my problem. I donā€™t want to reinstall my system just to find out it still doesnā€™t work.

If I do need to reinstall the OS, could you give me the exact steps so that I can reproduce all the things that should be done?

Also, what things in the following post is relevant. It seems that most of the content over there is not relevant to sonic-pi.

I included the reference to the new OS as it lists many of the problems users have found in upgrading to the new os, many of which are sound related.

It looks like you have 3.2.2 installed, but also parts of 3.1, so you might consider using
sudo apt autoremove to get rid of some redundant stuff. Alternatively
sudo apt purge sonic-pi
followed by
sudo apt autoremove
The new OS has had several sound related changes since it was released, so it is worth doing
sudo apt update
sudo apt upgrade
to make sure it has all the latest files.
Then reinstall sonic-pi 3.2.2 from the deb file.
Then add the temporary fix detailed here to add the changes to get sonic pi to play ball with pulseaudio.
Reboot the machine having doe so then try sonic-pi. Hopefully all being well you should them be able to select your sound source by right clicking the loudspeaker icon.

I frequently build new sd cards from scratch. It is a fairly straightforward process and avoids problems that may arise from upgrading a previous OS eg scratch to buster.

Iā€™m sorry you are having these difficulties. We are working hard with Sonic Pi to get version 3.3 ready, and this should include fixes so that it will work properly with the latest Raspberry Pi OS. Hopefully ready in the next few weeks for Mac Windows and RPI. I am currently testing a new .deb file for the latest beta, although there are a few further changes to be incorporated before the release.

Regarding ā€œtemporary fix detailed hereā€, should I just following the above URL by running the following commands?

wget https://gist.githubusercontent.com/rbnpi/8812203f5c9a995620bed9ce3a3c6a20/raw/930b4154043502796854c37f9b8ca8cccc0273a7/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/lib/sonicpi/scsynthexternal.rb

Just to be sure, the output of the install is as expected?

$ sudo apt install ./sonic-pi_3.2.2_4_armhf.deb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Note, selecting 'sonic-pi' instead of './sonic-pi_3.2.2_4_armhf.deb'
The following additional packages will be installed:
  compton erlang-base erlang-crypto erlang-syntax-tools fonts-lato libaubio5 libconfig9 libqt5opengl5 librtaudio6 librtmidi4 libruby2.5 libscsynth1
  libsctp1 libstk-4.5.0 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby-xmlrpc ruby2.5 rubygems-integration
  sc3-plugins-server supercollider-server
Suggested packages:
  erlang-tools erlang erlang-manpages erlang-doc lksctp-tools ri ruby-dev bundler ladspalist
The following NEW packages will be installed:
  compton erlang-base erlang-crypto erlang-syntax-tools fonts-lato libaubio5 libconfig9 libqt5opengl5 librtaudio6 librtmidi4 libruby2.5 libscsynth1
  libsctp1 libstk-4.5.0 rake ruby ruby-did-you-mean ruby-minitest ruby-net-telnet ruby-power-assert ruby-test-unit ruby-xmlrpc ruby2.5 rubygems-integration
  sc3-plugins-server sonic-pi supercollider-server
0 upgraded, 27 newly installed, 0 to remove and 0 not upgraded.
Need to get 13.9 MB/84.0 MB of archives.
After this operation, 259 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf fonts-lato all 2.0-2 [2,698 kB]
Get:9 /tmp/sonic-pi_3.2.2_4_armhf.deb sonic-pi armhf 4:3.2.2 [66.5 MB]                          
Get:7 http://mirror.sjc02.svwh.net/raspbian/raspbian buster/main armhf libqt5opengl5 armhf 5.11.3+dfsg1-1+rpi1+deb10u4 [137 kB]                   
Get:2 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf erlang-base armhf 1:21.2.6+dfsg-1 [7,445 kB]
Get:3 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf erlang-crypto armhf 1:21.2.6+dfsg-1 [142 kB]                                     
Get:4 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf erlang-syntax-tools armhf 1:21.2.6+dfsg-1 [379 kB]                               
Get:5 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf libaubio5 armhf 0.4.6-2+b1 [73.1 kB]                                             
Get:6 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf libconfig9 armhf 1.5-0.4 [27.7 kB]                                               
Get:8 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf librtaudio6 armhf 5.0.0~ds-3 [38.5 kB]                                           
Get:10 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf librtmidi4 armhf 3.0.0~ds1-2+b1 [32.1 kB]                                       
Get:11 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf rubygems-integration all 1.11+deb10u1 [5,212 B]                                 
Get:12 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby armhf 1:2.5.1+b1 [11.6 kB]                                                 
Get:13 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf rake all 12.3.1-3+deb10u1 [67.1 kB]                                             
Get:14 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby-did-you-mean all 1.2.1-1 [14.4 kB]                                         
Get:15 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby-minitest all 5.11.3-1 [54.8 kB]                                            
Get:16 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby-net-telnet all 0.1.1-2 [12.5 kB]                                           
Get:17 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby-power-assert all 1.1.1-1 [10.9 kB]                                         
Get:18 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby-test-unit all 3.2.8-1 [72.4 kB]                                            
Get:19 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf ruby-xmlrpc all 0.3.0-2 [23.7 kB]                                               
Get:20 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf libscsynth1 armhf 1:3.10.0+repack-1+rpi1 [203 kB]                               
Get:21 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf libsctp1 armhf 1.0.18+dfsg-1 [27.6 kB]                                          
Get:22 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf libstk-4.5.0 armhf 4.5.2+dfsg-5+b2 [164 kB]                                     
Get:23 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf supercollider-server armhf 1:3.10.0+repack-1+rpi1 [615 kB]                      
Get:24 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf sc3-plugins-server armhf 3.9.1~repack-3+b1 [1,597 kB]                           
Get:25 http://raspbian.mirrors.lucidnetworks.net/raspbian buster/main armhf compton armhf 0.1~beta2+20150922-1 [91.0 kB]                                    
Fetched 13.9 MB in 17s (798 kB/s)                                                                                                                           
Selecting previously unselected package fonts-lato.
(Reading database ... 161158 files and directories currently installed.)
Preparing to unpack .../00-fonts-lato_2.0-2_all.deb ...
Unpacking fonts-lato (2.0-2) ...
Selecting previously unselected package erlang-base.
Preparing to unpack .../01-erlang-base_1%3a21.2.6+dfsg-1_armhf.deb ...
Unpacking erlang-base (1:21.2.6+dfsg-1) ...
Selecting previously unselected package erlang-crypto.
Preparing to unpack .../02-erlang-crypto_1%3a21.2.6+dfsg-1_armhf.deb ...
Unpacking erlang-crypto (1:21.2.6+dfsg-1) ...
Selecting previously unselected package erlang-syntax-tools.
Preparing to unpack .../03-erlang-syntax-tools_1%3a21.2.6+dfsg-1_armhf.deb ...
Unpacking erlang-syntax-tools (1:21.2.6+dfsg-1) ...
Selecting previously unselected package libaubio5:armhf.
Preparing to unpack .../04-libaubio5_0.4.6-2+b1_armhf.deb ...
Unpacking libaubio5:armhf (0.4.6-2+b1) ...
Selecting previously unselected package libconfig9:armhf.
Preparing to unpack .../05-libconfig9_1.5-0.4_armhf.deb ...
Unpacking libconfig9:armhf (1.5-0.4) ...
Selecting previously unselected package libqt5opengl5:armhf.
Preparing to unpack .../06-libqt5opengl5_5.11.3+dfsg1-1+rpi1+deb10u4_armhf.deb ...
Unpacking libqt5opengl5:armhf (5.11.3+dfsg1-1+rpi1+deb10u4) ...
Selecting previously unselected package librtaudio6:armhf.
Preparing to unpack .../07-librtaudio6_5.0.0~ds-3_armhf.deb ...
Unpacking librtaudio6:armhf (5.0.0~ds-3) ...
Selecting previously unselected package librtmidi4:armhf.
Preparing to unpack .../08-librtmidi4_3.0.0~ds1-2+b1_armhf.deb ...
Unpacking librtmidi4:armhf (3.0.0~ds1-2+b1) ...
Selecting previously unselected package rubygems-integration.
Preparing to unpack .../09-rubygems-integration_1.11+deb10u1_all.deb ...
Unpacking rubygems-integration (1.11+deb10u1) ...
Selecting previously unselected package ruby2.5.
Preparing to unpack .../10-ruby2.5_2.5.5-3+deb10u3_armhf.deb ...
Unpacking ruby2.5 (2.5.5-3+deb10u3) ...
Selecting previously unselected package ruby.
Preparing to unpack .../11-ruby_1%3a2.5.1+b1_armhf.deb ...
Unpacking ruby (1:2.5.1+b1) ...
Selecting previously unselected package rake.
Preparing to unpack .../12-rake_12.3.1-3+deb10u1_all.deb ...
Unpacking rake (12.3.1-3+deb10u1) ...
Selecting previously unselected package ruby-did-you-mean.
Preparing to unpack .../13-ruby-did-you-mean_1.2.1-1_all.deb ...
Unpacking ruby-did-you-mean (1.2.1-1) ...
Selecting previously unselected package ruby-minitest.
Preparing to unpack .../14-ruby-minitest_5.11.3-1_all.deb ...
Unpacking ruby-minitest (5.11.3-1) ...
Selecting previously unselected package ruby-net-telnet.
Preparing to unpack .../15-ruby-net-telnet_0.1.1-2_all.deb ...
Unpacking ruby-net-telnet (0.1.1-2) ...
Selecting previously unselected package ruby-power-assert.
Preparing to unpack .../16-ruby-power-assert_1.1.1-1_all.deb ...
Unpacking ruby-power-assert (1.1.1-1) ...
Selecting previously unselected package ruby-test-unit.
Preparing to unpack .../17-ruby-test-unit_3.2.8-1_all.deb ...
Unpacking ruby-test-unit (3.2.8-1) ...
Selecting previously unselected package ruby-xmlrpc.
Preparing to unpack .../18-ruby-xmlrpc_0.3.0-2_all.deb ...
Unpacking ruby-xmlrpc (0.3.0-2) ...
Selecting previously unselected package libruby2.5:armhf.
Preparing to unpack .../19-libruby2.5_2.5.5-3+deb10u3_armhf.deb ...
Unpacking libruby2.5:armhf (2.5.5-3+deb10u3) ...
Selecting previously unselected package libscsynth1.
Preparing to unpack .../20-libscsynth1_1%3a3.10.0+repack-1+rpi1_armhf.deb ...
Unpacking libscsynth1 (1:3.10.0+repack-1+rpi1) ...
Selecting previously unselected package libsctp1:armhf.
Preparing to unpack .../21-libsctp1_1.0.18+dfsg-1_armhf.deb ...
Unpacking libsctp1:armhf (1.0.18+dfsg-1) ...
Selecting previously unselected package libstk-4.5.0:armhf.
Preparing to unpack .../22-libstk-4.5.0_4.5.2+dfsg-5+b2_armhf.deb ...
Unpacking libstk-4.5.0:armhf (4.5.2+dfsg-5+b2) ...
Selecting previously unselected package supercollider-server.
Preparing to unpack .../23-supercollider-server_1%3a3.10.0+repack-1+rpi1_armhf.deb ...
Unpacking supercollider-server (1:3.10.0+repack-1+rpi1) ...
Selecting previously unselected package sc3-plugins-server.
Preparing to unpack .../24-sc3-plugins-server_3.9.1~repack-3+b1_armhf.deb ...
Unpacking sc3-plugins-server (3.9.1~repack-3+b1) ...
Selecting previously unselected package sonic-pi.
Preparing to unpack .../25-sonic-pi_3.2.2_4_armhf.deb ...
Unpacking sonic-pi (4:3.2.2) ...
Selecting previously unselected package compton.
Preparing to unpack .../26-compton_0.1~beta2+20150922-1_armhf.deb ...
Unpacking compton (0.1~beta2+20150922-1) ...
Setting up libconfig9:armhf (1.5-0.4) ...
Setting up fonts-lato (2.0-2) ...
Setting up erlang-base (1:21.2.6+dfsg-1) ...
Searching for services which depend on erlang and should be started... none found.
Setting up ruby-power-assert (1.1.1-1) ...
Setting up erlang-syntax-tools (1:21.2.6+dfsg-1) ...
Setting up rubygems-integration (1.11+deb10u1) ...
Setting up libaubio5:armhf (0.4.6-2+b1) ...
Setting up compton (0.1~beta2+20150922-1) ...
Setting up ruby-minitest (5.11.3-1) ...
Setting up ruby-test-unit (3.2.8-1) ...
Setting up libscsynth1 (1:3.10.0+repack-1+rpi1) ...
Setting up ruby-net-telnet (0.1.1-2) ...
Setting up libsctp1:armhf (1.0.18+dfsg-1) ...
Setting up libqt5opengl5:armhf (5.11.3+dfsg1-1+rpi1+deb10u4) ...
Setting up librtaudio6:armhf (5.0.0~ds-3) ...
Setting up librtmidi4:armhf (3.0.0~ds1-2+b1) ...
Setting up ruby-did-you-mean (1.2.1-1) ...
Setting up erlang-crypto (1:21.2.6+dfsg-1) ...
Setting up supercollider-server (1:3.10.0+repack-1+rpi1) ...
Setting up ruby-xmlrpc (0.3.0-2) ...
Setting up libstk-4.5.0:armhf (4.5.2+dfsg-5+b2) ...
Setting up sc3-plugins-server (3.9.1~repack-3+b1) ...
Setting up libruby2.5:armhf (2.5.5-3+deb10u3) ...
Setting up ruby2.5 (2.5.5-3+deb10u3) ...
Setting up ruby (1:2.5.1+b1) ...
Setting up rake (12.3.1-3+deb10u1) ...
Setting up sonic-pi (4:3.2.2) ...
Enabling /etc/security/limits.d/audio.conf for jackd2
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for fontconfig (2.13.1-2) ...
Processing triggers for desktop-file-utils (0.23-4) ...
Processing triggers for mime-support (3.62) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.31.4-3) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...

Yes that should be fine for applying the patch. Donā€™t forget to load in the pulseaudio module as well.
sudo apt install pulseaudio-module-jack
Your install of SP looks fine from what I can see.
Also when finished reboot before trying sonic-pi.
Iā€™ve just carried out the above on a Pi400 here and it worked fine. Iā€™m switching SP between HDMI audio and an exteranl usb card happily as it runs.