Change default audio device on Windows?

Reading the logs, it looks like Sonic Pi attaches itself to the first device it sees, which in my case is MME. MME is an absolutely terrible protocol for a wide variety of reasons, the primary (π-mary?) in my case being that on my computer it just doesn’t work for any program, Sonic Pi or otherwise.

I would like Sonic Pi to select a Directsound or WASAPI or WDM-KS protocol for my device, but I don’t see any option in the configuration files to declare a default audio device (the protocol being part of the overall device), and because Sonic Pi won’t actually load (SC_PortAudioDriver: PortAudio failed at Pa_OpenStream with error: ‘Unanticipated host error’ could not initialize audio.) I can’t do anything within the program itself to rectify this situation.

I installed ASIO4ALL which let me select a device on start up, even if I only have one.

I suspect you need to pass the right argument to scsynth but I’m not able to find the docs on how to set it.

I installed ASIO4ALL which let me select a device on start up, even if I only have one.

ASIO4ALL would only work if it was the first “device” Sonic Pi encountered on load - it handles this in a really primitive fashion (on first load, at least - can’t speak beyond that, since it won’t actually finish loading for me), where the first device it sees is the one it tries to grab hold of. In my case, that’s MME protocol for my audio interface.

Keep in mind that a “device” isn’t the same meaning here - it’s internal devices as determined by the OS, which aren’t the same thing as the number of physical soundcards connected to your computer. DirectSound, MME, ASIO, WASAPI, and WDM-KS all count as separate “devices” by this manner, even though it’s all just different ways of addressing the same piece of hardware.

Anyway, not gonna lie, I’m a little bit saddened that after four days no real support has manifested. This shouldn’t be a huge issue, programs should give a person a way of setting default parameters from outside the program, or at least not let an error like this cause an abort. It’s solved science - you pop up a dialog box informing the user of the error, then continue to load, so the user can navigate to preferences and configure what needs to be configured.

Hi @TingoAape,
Apologies that it’s been a bit quiet here over the last few days. The core team (all volunteers, besides Sam, who as mentioned elsewhere receives around 50% of his income from crowd-funding) have only just come out of a fairly intense period of Sonic Pi development on a new beta version, which amongst other things has involved quite a lot of work on completely rebuilding the MIDI subsystem. I personally have also been under the pump on a separate personal project with a looming deadline, so haven’t been able to spare as much time for forum interaction as I would like. Anyhow, sorry that you haven’t had a great experience.

I too am definitely aware that there is much more that we’d like to get done in future (including allowing ad-hoc selection of audio devices). We are of course always happy to welcome help towards this goal :smile:

1 Like

Hello @TingoAape I’m just a user of Sonic Pi, so I don’t know the code. But my observation is that it uses the current default sound device - not the first one it finds on the system.

I too had some problems with the sound on one Windows PC, and the simple fix was to use a cheapo USB sound card. An expensive USB audio interface box worked too! I’d give that a try.

I agree it would be great if you could select the device from within SPi, but given that this is a free tool with people working on it largely in their spare time, better that the effort is spent on other things probably. Just my opinion.

Re ASIO - I started expecting to use that as I do elsewhere for low-latency, but the model for handling latency in SPi is such that it’s not necessary, musically. Unless you’re wanting to use it as a midi-keyboard synth, but there’s better apps for that. WASAPI is fine, and is better behaved in other ways.

Hi all,

@soxsa is correct with respect to Sonic Pi binding to the system’s current default sound device. This is because Sonic Pi uses the SuperCollider synthesiser under the hood and this is SuperCollider’s default behaviour. This can be overridden by telling SuperCollider which device to attach to at launch, but as of v3.2.2 this isn’t something you can modify from Sonic Pi without changing the source code.

However, in v3.3 (which is currently available as a BETA over on Patreon (https://www.patreon.com/posts/43441419) this is something you can change by editing a config file. This will be documented in more detail once this has been finalised and released.

@TingoAape - I agree that it would be lovely to have this in the GUI and it’s something I’ve wanted for a while now. Unfortunately we don’t currently have the resources to do everything we want at the moment. Simply maintaining the software on the major platforms is already a huge effort before we start talking about developing new features. If you’d like to see this happening then if you have the time and ability, we’d love to work with you to help you implement this. Alternatively you can consider supporting the project financially so we can get to a position to be able to put more resources into new features like this.

2 Likes

For users of windows 10 it is necessary to configure the access of the programs to the audio device giving permission which includes microphone. In my case it worked.

Any advances on Asio implementation since this? the , I would love to conect the UA volt 476 but im not able to implement the solutions i found here, settings.json i cant find neither where to touch the code of sunthexternal.rb.
Im new to Sonic pi, and not very much of a coder…yet.