I hope all is well. I am brand new to coding, python, Raspberry Pi and Sonic Pi.
I was working on my first tutorial project, the ultrasonic theremin for the Rasberry Pi. I’ve installed Sonic Pi per the directions and tried a simple “Play 60” command. The scope moves like its playing the tone, however there is no sound via audio or hdmi jacks (my monitor has a speaker). I have the newest version of Sonic Pi straight off the website and all the volume are all the way up. My Rasbian distributions are all up to date.
I take it other programs are able to produce sound normally?
I will say that I’m not terribly familiar with the exact issue here, (someone like @robin.newman may know more) but I wonder if it’s somehow not able to play through the HDMI output, whether explicitly setting the Pi’s default audio output to analogue would make the headphone output work.
There’s a bunch of comments on the release notes for the Raspberry Pi OS update back in May this year about audio issues such as this: perhaps setting the default output to analogue may help?
See:
(specifically comments near the bottom of the article such as this):
Some people have asked how they can switch the audio output from the command line without using the desktop. To do this, you will need to create a file called .asoundrc in your home directory; ALSA looks for this file to determine which audio device it should use by default. If the file does not exist, ALSA uses “card 0” – which is HDMI – as the output device. If you want to set the headphone jack as the default output, create the .asoundrc file with the following contents:
defaults.pcm.card 1
defaults.ctl.card 1
This tells ALSA that “card 1” – the headphone jack – is the default device. To switch back to the HDMI output, either change the ‘1’s in the file to ‘0’s, or just delete the file.
Hi @lwadz88,
Following on from Ethan’s reply, another solution is to allow Sonic Pi to integrate with pulseaudio by making adjustments to one of the files scynthexternal.rb. I have described how this can be done in this post which explains what needs to be done. The advantage is that you can then right click the volume control icon on the taskbar and switch between any of the output audio devices available on your particular raspberry pi including any plugged in usb cards. I find that this simple card gives very reasonable results.
The above technique is convenient but you will get lower latency with another alternative, which is to enable QjackCtl in the Sound Section of the Main Menu which you can do using the Main Menu->Preferences->Main Menu Editor. `You can then start this program BEFORE launching Sonic Pi and set it up to use the sound output you wish. I did a rather sketchy run of this two years ago and sections of this thread give further ideas. Note this technique will take over the output audio device that you select whilst qjackctl is running, whereas the pulseaudio route enables programs to share your output device. If you make the modifications to scsynthexternal.rb you can then use either method.