ASIO4ALL / Sound Quality of Supercollider on Windows
UPDATE: While the post below is still valid to get ASIO4ALL running, the low tone aliasing I mentioned can be fixed without using it.
- Right click the speaker icon in your system tray and choose playback devices.
- Right click your audio device and hit properties.
- Hit the advanced tab.
- Set the default format to 16 bit, 44100 Hz (CD Quality)
I have been having issues with the sound quality of Supercollider on Windows for quite a while now. I have posted to the mailing list about this in the past and really gotten nowhere. Up until this point mostly I have just avoided writing pieces where the issue would be audible.
After replacing my ancient sound card on my studio PC with a Behringer X1204USB the problem was instantly solved. This gave me a tip that it might be something with the low quality built in sound cards and not with the Windows build of Supercollider itself.
The Problem
The following line should result in a pure low sine wave:
play{SinOsc.ar(30)}
On my systems it was accompanied by a very high pitched tone. The scope window showed the correct output but the audio was clearly not the pure tone it should be. The issue existed no matter the pitch but was most apparent on low sine waves.
ASIO
According to wikipeida ASIO is:
Audio Stream Input/Output (ASIO) is a computer sound card driver protocol for digital audio specified by Steinberg, providing a low-latency and high fidelity interface between a software application and a computer’s sound card. Whereas Microsoft’s DirectSound is commonly used as an intermediary signal path for non-professional users, ASIO allows musicians and sound engineers to access external hardware directly.
The Berhinger mixer uses ASIO whereas the internal sound card on the other boxes do not. This is where ASIO4ALL comes in. According to it’s website ASIO4ALL is:
ASIO4ALL is a hardware independent low latency ASIO driver for WDM audio devices. It uses WDM Kernel-Streaming and sometimes even more sophisticated methods to achieve its objectives.
ASIO4ALL is a amazingly useful tool that should be in every Windows based electronic musician’s tool belt. Besides correcting the output issues I was having with Supercollider ASIO4ALL can also dramatically improve the latency on your audio system.
Correcting The Problem
After downloading and installing ASIO4ALL you will notice it has been added to the list of available audio devices when Supercollider boots.
Device options: - MME : Microsoft Sound Mapper - Input (device #0 with 2 ins 0 outs) - MME : Microphone (Realtek High Defini (device #1 with 2 ins 0 outs) - MME : Stereo Mix (Realtek High Defini (device #2 with 2 ins 0 outs) - MME : Microsoft Sound Mapper - Output (device #3 with 0 ins 2 outs) - MME : Speakers (Realtek High Definiti (device #4 with 0 ins 2 outs) - ASIO : ASIO4ALL v2 (device #5 with 2 ins 2 outs) Booting with: In: MME : Microphone (Realtek High Defini Out: MME : Speakers (Realtek High Definiti Sample rate: 44100.000 Latency (in/out): 0.013 / 0.091 sec SC_AudioDriver: sample rate = 44100.000000, driver's block size = 64
In order to being using ASIO4ALL I added the following line to my startup file BEFORE the server boots:
s.options.device_("ASIO : ASIO4ALL v2");
The next time you restart the server you can verify that you are now using ASIO4ALL by looking for the following lines in your console:
Booting with: In: ASIO : ASIO4ALL v2 Out: ASIO : ASIO4ALL v2 Sample rate: 44100.000 Latency (in/out): 0.016 / 0.000 sec
At this point you will see the ASIO4ALL options appear in your system, it is a green square with a white triangle. This will allow you edit your settings for the application if needed.
Further Work Required
If you run the test sine again and hear sound then congratulations, you have set up ASIO4ALL with Supercollider. This was not my experience on either box I tested it on. The scope window showed the sine wave was playing but no audio would sound.
At this point you need to:
- Open the ASIO4ALL settings and click the wrench in the lower right-hand corner
- Click the plus sign next to your sound card
- If the output shows a red X then click to highlight the name
- Hover the mouse over the name to see the error
Disable Exclusive
To avoid the first error (In use by another application) from occurring in the future:
- Right click on the volume icon in your system tray
- Choose “Playback Devices”
- Right Click and choose properties on the device you wish to use
- Click the Advanced tab
- Uncheck “Allow applications to take exclusive control of this device”
- Hit OK
- Hit OK
- Reboot
“Wavetable Synth” Issue
On both the boxes I tested this issue was not corrected at this point. I wanted to leave the above solution in the post because I have seen reports of people fixing their problems using that solution. The “Wavetable Synth” issue can be fixed by the following:
- Right click on the volume icon in your system tray
- Choose “Playback Devices”
- Right Click and choose disable on the device you wish to use
This solution is less then ideal, but it’s the only way I have gotten this working so far. You are disabling the device so it cannot be used by any Windows applications except ASIO4ALL. You will want to re-enable the device when you want to use another application that plays sound.
One More Thing
One other issue I have experienced with this is that SCLang will not shut down properly after you start using ASIO4ALL. If you close the application while sound is running it begins skipping. Even if you shut down while Supercollider is silent the process will silently be hung in the background, thus stopping you from starting a new instance or re-enabling your sound card for other applications.
To fix this:
- Hit Ctrl-Shit-Esc to launch Task Manager
- Select the Processes Tab
- Right click SCLang.exe
- End Processs
Conclusion
I know this process is less then ideal but at the moment it is the only way I have gotten the correct output out of some of the built in sound cards I have tried using. If you have any additional information or alternate solutions please comment on this post and I will update it.