Pisound first impressions with Sonic Pi 3

I picked up my pisound today, after they tried to deliver when I was out yesterday, and have just set it up to work with Sonic Pi 3 on a beta build of Raspbian Stretch. I thought I would report back on how it worked, and make some comments and corrections on the Sonic Pi FAQ. Building the case was fun, but it all fitted together nicely. The only problem I had was that there was insufficient clearance between the Sound In 1/4" jack socket and my HDMI lead. This was solved by leaving off the hexagonal nut and washer on the socket.
I then installed all the software on a beta build of Rasbian Scratch and I am glad to say that it all installed OK with no problems, although the installation of cython at the end took a HUGE amount of time…Don’t worry it gets there eventually but we are talking many, many minutes. I suggest taking the option to set pisound as the default sound card, when asked, and I also said yes to all the other options.
I then looked at the FAQ for getting Sonic PI working with pisound. I quickly spotted one slight error. The scsynthexteranl.rb file is given the wrong locations. It should be:
/opt/sonic-pi/app/server/sonicpi/lib/sonicpi/scsynthexternal.rb and not
/opt/sonic-pi/app/server/sonicpi/scsynthexternal.rb as specified in the FAQ

You should carry out the change notified there in the case statement, but also scroll to the end of the file and correct the two commands to connect inputs to scsynth

The jack_connect SuperCollider:in_1 system_capture_1
and jack_connect SuperCollider:in_1 system_capture_1
should be:
jack_connect SuperCollider:in_1 system:capture_1
jack_connect SuperCollider:in_2 system:capture_2
as shown in the screen shot.

Secondly, when you come to start jackd by using Qjackctl it didn’t appear on the menu in my beta Stretch build, but I ran it from a command line with qjackctl &
You will find that the screen layout is a little different from that shown in the FAQ diagram. The setup screen has different tabs added. you will need the Settings tab, and you adjust both the Parameters and the Advanced tabs.
The two screen shots below show the settings I used. Essentially they are similar same as for the screenshot in the existing FAQ, although I altered the Port Maximum number on the Advanced tab from 256 to 1024, as I was running a Raspberry Pi3, and Sam Aaron has recently upgraded the maximum number of ports for Sonic PI 3 on the Pi3 to 1024. Also make sure you set the midi driver to seq on the Advanced tab. I also played quite a lot with the settings for Sample_rate, Fremes/Period and Periods/Buffer. These are a trade off between low latency and Sonic Pi being able to play notes without breakup or scratching. You want to get farily near to the limit, and that may depend upon the music that you are trying to play in Sonic Pi. Currently I am using Sample_rate 88200, Frames/Period 1024 and Periods/Buffer 2, which is giving a reasonably dropout free performance, but you may find you prefer different settings. As a guide, the settings used by Sonic Pi normally are 44100,1024 and 3, but this gives a rather high latency, and was set really before midi and audio input became a realilty for Sonic Pi. You can go for a very low latency using the figures in the current FAQ picture, 96000,256 and 3. This will give exceptionally low latency, but you will get a lot of breakup in the notes. Unfortunately Sonic PI takes a long time to start up at present, and so it is quite a tedious process testing various combinations. Basically, quit Sonic Pi, press the stop button in Qjackctl, go to setup and adjust the parameters, then press the Start button in Qjackctl, wait for it to start, and the restart Sonic Pi.

To use Sonic Pi 3,start qjackctl going with the settings in the two screen shots. Then start Sonic PI3, It takes quite a time to initialise, but gets there eventually. You will find that the Volume icon on the top right of the screen is inaffective, but you can control volume output with the volume knob on the pisound. It is also affected by the mastervolume slider in Sonic Pi. I sent the audio output of the pisound card to a little Drok amplifier module I bought recently on Amazon. This was then fed to two large speakers I already had. It is rated at 50W so gives lots of oomf!
On the input side, I connected a Korg X5DR module audio output to the Sound In jack, and tried it with the new live_audio command in Sonic PI 3. It worked very well indeed. I also tried connecting a USB midi keyboard (an M-Audio Oxygen8) to the Pi3, and got that to play notes in Sonic Pi3 using the new midi commands incorporated in it. Again it worked very well with low latency.
So my initial impressions of pisound ar that it is a really excellent bit of kit. Something the Rasberry Pi and Sonic Pi have been sorely in need of for some time. If you’re at all serious about making music with Rasberrry Pi, then buy one.


Hi. Thanks for the Sonic PI 3 info. Does Sonic PI 3 now support headless mode?

Yes with a bit of jigging around.
You will need to start jackd presumably from a command line using the settings from Qjackctl
EDIT you could revert to the Raspberry Pi startup in scsynthexternal.rb and write in specific paramters to start jackd there, so that it was started by SP. Doing it the way given in the FAQ just makes it easier to setup jackd paramters approrpiately. If you know what you want and you aren;t going to change them you could do it with hard coded values.

Then you can start Sonic Pi headless using
this post
Then you can use Nick Johstone’s sonic-pi-cli gem to send commands direct to Sonic-Pi to run a particular program
eg sonic_pi ‘run file “~/Desktop/test.rb”’
You could incorporate the ability to receive OSC messages in this test.rb program which could then further control the operation of Sonic PI.

I’ve just tried the above (apart from starting jackd which I did using Qjackctl for now) and it works.
It could be tidied up to make it more seamless ending up with something like
start_sonicpi test.rb where test.rb was the program to use.


Hello fellow Sonic Pi fan!!! Thank you for this great writeup. I had been having issues with Audio in , and reading this helped me to realize that I was just derping on linking the system in to the Supercollider In.
Have you been getting a lot of Xruns? I have everything turned all the way up, as far as buffers, but I still get a lot of breaking up if I try to play a chord, and everything grinds to a halt after about an hour of usage (even MIDI-only output). I haven’t been doing anything more intense than I ever had with a regular RasPi3, but I’m finding my resources a lot more limited at the moment. I’m not sure if maybe stretch still needs some work, or if I’m missing a setting in jackd, or if there’s an SP command that will open up resources at the expense of latency or what. A lot of X-factors between a new Raspbian, a new sound card, and a new version of SP. Anything you can tell me about your setup and experience would be greatly appreciated.

Hey, the performance issues may occur if the sampling rate is not one of the natively supported ones. Make sure you set the sampling rate to be one of 48000, 96000 and 192000, otherwise resampling will occur. Please let us know if this was indeed the issue. :slight_smile:

I tried switching from 96000 to 48000 and that has proven to be a huge improvement. I’ve been playing a track with 4 note chords with short overlapping and several additional live loops perfectly for about 20 minutes now! I was also able to play a heavily intentionally glitching track for a good little bit. On my previous session I did get to a point where I got a slew of Xruns and then Supercollider stopped responding to play commands, but that may be something for me to bring up at the SonicPi forum. I appreciate the suggestion for me to mess with the sample rate.

1 Like

Hi Nicholas
Like yourself I find that Sonic Pi 3, is much more easily taxed as regards Xruns than its predecessors, but I suppose that this is not unexpected as it doing a heck of a lot more behind the scenes that previously, supporting midi I/O and audio I/O
I have played around quirte extensively with differnt settings for the paramters in jackd, using qjackctl intially, and then committing the parameters to the command line within Sonic PI. Currently I am working at 96000 for the sample rate, and using 1024 byte buffer with either 2 or 3 periods. Even with these settings I get some xRuns if SP is taxed heavily.
This means that you have to go easy on using fx, especially if nested. Also some synths cuase more problems than others.
However I find that using midi to an external synt and then feeding the audio back into Sonic Pi works pretty well, and I have done quite a lot of stuff using this setup.
I have two pisounds, and I have worked quite a bit using modep on one of them, and Sonic Pi 3 on the other, and sedning midi across to synths in modep with the audio returned to Sonic Pi. You may have see `a recent project I did with this setup https://rbnrpi.wordpress.com/2017/08/25/a-touchosc-jukebox-for-sonicpi/ which created a jukebox for Sonic Pi, and this ensabled a wide variety of pieces to be played on Sonic Pi without significant xruns.

For anything really meaty I tend to use SP on my Mac which handles things with ease.

PS I find that using the clear command on Sonic Pi, can help to clear things a bit if you start to get a lot of distortion and breakups.


OMG! Thank you rbn, I appreciate the feedback, I will see if clear helps next time I have an issue. Your project looks awesome. I haven’t delved into OSC much yet, but my friends and I have some great plans for doing some generative A/V stuff that way with OpenFrameworks on another Pi.
I teach a Sonic Pi class for middle schoolers and tomorrow will be the first day that we’ll all have 3.0.1 for OSX sitting in front of us. I look forward to seeing how it runs!

Hi rbn, first I have found your post extremely useful to configure the settings of my qjack, so thanks.
I am only having trouble with the sound_in and live_audio commands in Sonic Pi. I could get usb midi devices to work but nothing comes out from these two functions. My gear is a Raspberry Pi 3 with raspbian stretch and obviously a Pisound. In the jack-input of the Pisound I have a bass plugged in and the output goes to a bass amplifier. I lunch qjackctl and hit start before opening Sonic Pi and if I write any other commands it will play but not with the sound_in / live_audio. Any idea of what I might be missing?

On a side note, before using your qjack settings, my bass was coming out of the Pure-Data patches that come with the default but after changing those parameters I can´t make it work, even when I choose from all the audio options available.

Any piece of advice on what might be the issue is welcome and appreciated.

If you mean patches, launched using the button, don’t produce audio, then it’s because they are launched with ALSA backend and it’s blocked by jack server running. If the jack server is stopped, the patches launched via the button should work.

Ok that worked. Patches launched using button only produce audio while jack server is stopped. Any chance of having Sonic Pi and Pure Data working at the same time?

How should I configure the “connect” panel of the jack server? I thought It might be the issue behind the non working Sonic Pi commands that use the audio input. In the help section, Sonic Pi says that both, sound_in and live_audio will look for input 1 unless specified otherwise. I imagine the jack input of the Pisound is considered my input 1?

I think in the latest versions, Sonic Pi starts Jack server correctly on its own, try running it without any modifications, hence we have removed the FAQ entry mentioned in the 1st post on this topic.

We’ll look into making Pure Data launched via the button work with Jack server as part of working on Blokas OS image (a customized Raspbian image with common audio software preconfigured to play well together)

Solved it! I was missing the link between System/capture_1, capture_2 and Supercollider/input_1, input_2. The default in not linked in the “connect” panel of Qjack.

Now Im trying to get rid of the latency!