I just started using SonicPi on my pi4 and cannot get sound to my USB audio interface. The interface itself is a Behringer UCA222. I am able to get sound everywhere else in Raspbian, just not in SonicPi. The weird part is that if I change my sound device to HDMI, SonicPi plays through my monitor speakers without issue. Is there anything I can do to troubleshoot the issue? I attempted to launch qjackctl. My only option for routing was the input/output from Super Collider. I did not see any options for my usb device. The three interface options in qjackctl settings are HW: AlSA bcm2835, hw:Codec usb audio codec, and hw:Codec,0 usb audio (hw1:0).
I have the same issue. I read somewhere something about changing the default audio device, but I wasn’t clear on how that was being done and it didn’t solve my problem of needing to be able to have two users, one using the analog audio and the other using the UBS concurrently. I see this topic is over a month old with no answers, so I’m hoping to see something happen.
unfortunately I don’t currently have the resources to support Linux at this stage.
There used to be a handy audio-output control in the Sonic Pi preferences, but the Raspberry Pi Foundation requested that I remove it so I did.
You will need to use the Raspbian settings to switch audio output. Also, be aware as the previous poster pointed out that Sonic Pi uses jack to send audio, so this may also need to be configured correctly.
Others in this forum who may be using Raspberry Pis may be able to help. Additionally the Raspberry Pi forums might also be able to help you
Good luck and if you find a solution please do share it with us all here!
I can not help with the Raspberry, but I assume this is very similar to Linux, because as Sam notes both use Jack. I have a Focusrite Scarlett 2i2 (USB), which I can use without any hassle with Sonic Pi. You don’t have to configure Sonic Pi to use your USB-Audio-Interface, you configure Jack to do so and then Sonic Pi uses what Jack supplies.
Here is what you could try:
arecord -l **** Liste der Hardware-Geräte (CAPTURE) **** Karte 0: PCH [HDA Intel PCH], Gerät 0: ALC269VC Analog [ALC269VC Analog] Sub-Geräte: 1/1 Sub-Gerät #0: subdevice #0 Karte 1: USB [Scarlett 2i2 USB], Gerät 0: USB Audio [USB Audio] Sub-Geräte: 1/1 Sub-Gerät #0: subdevice #0
(Sorry, output is partly in German). Plug in your audio interface and use e. g.
arecord to find out your sound cards. I then have a simple bash script which either uses my USB-Interface …
#! /bin/bash pulseaudio --kill & jackd -d alsa --device hw:USB --rate 48000 --period 512 --nperiods 3 sleep 1 qjackctl --start & sleep 1 sonicpi &
or the internal soundcard
pulseaudio --kill & jackd -d alsa --device hw:0 --rate 44100 --period 1024 & # instead of "hw:0", "hw:PCH" should also work but I didn't try sleep 1 qjackctl --start & sleep 1 sonicpi &
Actually I have some more things going on, which have to do with my specific setup. What I posted should be enough; of course you will have to find out which Jack settings work best for you.
I am sure this can be done more elegantly, but it does the trick for me.
Let me know, if this is of any help.
That sounds reasonable. However, when I try to kill pulseaudio, I get
[pulseaudio] main.c: Failed to kill daemon: No such process
And then, just to check:
jackd -d alsa --device hw:USB --rate 48000 --period 512 --nperiods 3
`default’ server already active
Failed to open server
So, I’m not really sure what’s going on.
Oddly, arecord -l produces
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
Subdevice #0: subdevice #0
Which isn’t even showing the on board audio, which does work.
well it seems 1.
pulseaudio isn’t running at all. So simply skip this. And in this context 2. it makes totally sense, that
Jack is already running to give you sound at all. I think I would try to kill the
Jack process just to see, if you can call it again with
jack -d ... and your USB device.
But you are right: It seems weird that your onboard card doesn’t appear. There are some other commands to list audio devices. You can also start
alsamixer (console) and use F6 to list the devices - just to check whether this shows something different.
Sorry that I can’t be more specific, this is somehow poking around in the dark. Maybe the Raspberry Pi Audio Configuration docs will help. Interestingly it says:
The Raspberry Pi has two audio output modes: HDMI and headphone jack. You can switch between these modes at any time.
Just tried an experiment on my Pi4 with fresh install of latest Buster 2020-02-05.
I have a cheap plugin usb dongle 3D SOUND which I plugged in.
It was recognised by the audio select or (which you get to by right clicking the loudspeaker symbol on the desktop.
In order to use it with Sonic Pi you have to configure jackd to work with it. The easiest way to do this is to use the Qjackctl GUI control for jackd. This is installed by default on Buster, but is not enabled in the Menu. This is easily resolved by selecting Main Menu Editor from Preferences on the Main Menu, and then navigating to Sound & Video on the resulting window, and ticking the box beside QjackCtl to enable the entry in the menu. Click on OK to close the Menu Editor, and then you will find QjackCtl on the Sound & Video section of the Main Menu from where you can start it running.
Now click the setup button.
On the parameters tab you can adjust the Sample Rate, Frame/Period and Periods/Buffer.
These will affect the audio latency, and it is a trade off to get low latency, versus the audio breaking up because there is not enough time for it to be processed. With the USB card I had I could use the settings shown, whereas you needed a larger buffer size 1024, 0r 2048 with the built in audio on the Raspberry Pi. If you get a lot of break up on the settings you choose, you can alter then, and restart qjackctl and then Sonic Pi again. If you have an older Pi, you will also find that you need a larger buffer.
The Advanced tab lets you specify which audio card to use. I find it is safer to specify this directly rather than use default. Here I specified USB Headphones for the Output Device and USB Audio (hw,0) for input
You can leave other panels as they are and click OK to save the settings.
BEFORE you click the start button, it is a good idea to make sure that jackd is not already running. If you have used Sonic Pi in the current session (without qjackctl) then it leaves the copy of jackd running that it starts up.
start a terminal window, and type killall jackd in it, then close the window again.
Now click the start button for QjackCtl and the screen will “light up” all being well as jackd starts up.
Now you can start Sonic Pi. (For this demonstration I used the version supplied with Buster, although it is in fact cut-down and doesn’t support Midi or OSC calls, and I usually use my own build of Sonic Pi 3.2dev which does).
When Sonic Pi has started, bring QjackCtl to the front again.
Open the Connext Window.
You should see that SuperCollider output is connected to the system audio input.
If your usb card also supports input, you can open the system output (rather confusingly this is your microphone input) and connect it to SuperColliders input ports (by default 2 available in Sonic Pi).
In my case it was a mono input so there is only one connection to make.
Now all being well you can start playing Sonic Pi through your audio USB output.
Whn you quit Sonic Pi, you can quit jackd in QjackCtl then close that down.
On subsequent runs, QjacCtl will remember your audio settings and you just start jackd from it BEFORE you start Sonic Pi. You will still have to connect the input if you want to use that. It is possible to automate that, but I think this post is long enough already!
Finally to whet your appetite, here is the same setup, this time with Sonic Pi 3.2dev with new scopes and transparent screen.