Monday, October 28, 2013

Installing SuperCollider on Windows 7 and 8 and dealing with 'Device unavailable' could not initialize audio'

After another break from SuperColliding and switching from OSX to a Windows machine I thought I'd share my experiences installing and setting up SC on windows.

A few years ago when I first started with SuperCollider the Windows port was something of a poor relation to the lead OSX platform and the up and coming Linux port, but things have changed since then and the latest Windows version seems pretty good so far. The only downside I've found so far is driver and hardware support issues, although this may not be much of a problem depending on what hardware you have.

Installing the latest Windows port is theoretically pretty easy, just head over to the Sourceforge repository and download the latest version of the installer. All being well it should install itself without any bother from the super easy to use config GUI and you'll be ready to go.

I had no trouble at all setting it up on my Windows 7 laptop, everything worked right first time, no issues at all. My Windows 8 desktop on the other hand was a bit tougher.

I'm not sure, but I don't think it was an OS issue, it seems more likely that it was a hardware driver issue with my motherboard's crappy on board sound .

After using the installer and trying to boot the server for the first time I got this error:

'SC_PortAudioDriver: PortAudio failed at Pa_OpenDefaultStream with error: 'Device unavailable'
could not initialize audio'

Very helpful. After some Googling it seemed like a driver problem and the solution was something I already happened to have installed, ASIO4ALL. This is a universal ASIO driver which gives ASIO support to a whole range of crappy Windows sound cards that don't usually support it. Windows SuperCollider apparently plays nicely with ASIO sound cards, so using this should help.

The next thing I needed to do was to get SuperCollider to talk to my sound hardware in ASIO mode, which was pretty easily achieved by running this line of code:

Server.local.options.device ="ASIO4ALL"

Which I added to my startup file so it runs every time I open up the SC IDE.

And, success! Well nearly, because for reasons I really don't understand sometimes it works and sometimes it doesn't. Often when I boot the server ASIO4ALL says that the output device is unavailable and I have to disable it and enable it again to make it work. I think I might be better of getting a discrete sound card.

In short,

SuperCollider on Windows is pretty easy to get going if you are lucky with your sound hardware. If not Try ASIO4ALL, it's free and is very easy to install. It might be helpful.

Wednesday, July 20, 2011

Detuning oscillators.

I'm still not entirely sure how PmonoArtic works, perhaps it will forever remain a mystery, but I do know how the important part of this synth def I came up with works. Well more or less anyway.


arg lagLev = 0.2, freq= 440, cutoff = 500, gate = 0.5;
var osc1 = Mix.fill(8, { + 10.0.rand, 0, 0.05) }); var filterEnv =, 0.1, 0.05, 1), gate, doneAction:2);
var filterOutput =, cutoff * filterEnv, 3.3);, filterOutput);


\freq, Pseq([440,330,440,330,550,770,880], inf),
\legato, Pwrand(#[0.5, 1.0], #[0.1, 0.9], inf),
\dur, 0.3,
\cutoff, Pwhite(5000, 10000, inf)


This is inspired by something I read on the SC Users list and it's an attempt at a synth that's more analoguesque. It didn't work quite as well as I had anticipated, so I think I'll have to try some more advanced techniques, but I suppose it's a start.

The significant bit is this line:

var osc1 = Mix.fill(8, { + 10.0.rand, 0, 0.05) });

Here I'm using the Mix command along with fill to create an array of eight different oscillators all tuned slightly differently, randomly assigned plus or minus 10hz from the frequency passed to the sythdef. It's supposed to give it a vaguely chorus like effect by layering detuned oscillators, which it does a bit, but the effect isn't quite as noticeable as I thought. Increasing the number of oscillators doesn't help much and increasing the frequency that they can change by sounds pretty horrible.

The mix and fill commands are pretty simple to use, by the way.

On it's own you can use to mix an array of channels together, or you can use Mix.fill(n, function) to create a whole new array of channels with the function you specify.

I could be wrong, but I think that when you use Mix.fill in a synth def it will only evaluate the function when the synth is loaded, so if you're using random varaibles like I am above, they'll only be random once when it's run.

Tuesday, July 5, 2011

I've forgotten everything I ever learned about SuperCollider.

It's been so long I'm not even sure how to spell SuperCollider anymore, I think it's two lls, but that looks wrong.

Several versions of SC have come out since I last used it and of course lots of the quarks and plugins I had from previous versions now no longer work, so I've had to start from scratch with a fresh install. This is probably no bad thing as it means I need to work from the ground up and remind myself how it all works.

I've done this before I think, but now it's time to do again, a SuperCollider Theramin, this time with a phase effect.


Wednesday, April 20, 2011

I'm still alive.

I know it's been a very long time since I've updated this blog, but I'm still here and I think it's about time I started looking at Supercollider again. Watch this space.

Monday, November 30, 2009

'Harmoniser' with Tartini

A little patch I made today following on from the auto chip tune stuff from before. This time a 'harmoniser' type effect made with the same Tartini type resynthesising, using a live input. I've got 'harmoniser' in inverted commas because frankly it isn't very harmonic, but it's a start I suppose. Here's the code.

SynthDef("Harm", {|offSet1, offSet2, output, osc1, osc2, mix, pitch1, pitch2, fader|

var sound =;
var pitch =[0];
var amp =;
pitch =, pitch); // smooth
pitch = pitch.min(10000).max(10); // limit
pitch1 = pitch.cpsmidi.round + 40;
pitch2 = pitch.cpsmidi.round + 60;

pitch1 = pitch1.midicps;
pitch2 = pitch2.midicps;

osc1 =, amp * 2); // resynthesise
osc2 =, 0.2, amp * 2);
mix =[osc1, osc2]);
fader =, mix, -0.5);
output =, 0.3, 0.1, 0.9); // bit of reverb just to taste, output);



x = Synth("Harm");

Here Im using Tartini to determine the pitch of the input, then using fairly roundabout method converting it to two lots of midi notes, adding to it to increase the pitch then sending it to some oscillators and finally mixing it back with the original input. If you change the numbers that I've added to the pitches here,

pitch1 = pitch.cpsmidi.round + 40;
pitch2 = pitch.cpsmidi.round + 60;

you should be able to change the 'harmony'.

There may be a better method to shift the synthesised pitches, I'm not sure but this does seem to work.
It sort of sound okay with some guitar or vocal input, but really bad with anything more complex.

Friday, October 30, 2009

Installing bbcut2 in OS X

I've just upgraded to OS X Snow Leopard and apart from it giving me the ability to take up serpents, drink any deadly thing and not be hurt etc, I also found myself reinstalling SuperCollider from scratch, including all the extensions, quarks and what have you that I had in my previous install.
Everything went smoothly with the exception of bbcut, which took a bit of work. I had the same problem when I installed it the first time round, but I ended up taking such as circuitous route to getting it working that I couldn't remember what I'd done by the time I'd finished. This time I took a more systematic approach and I've isolated the problem.
The latest version of the extension pack provided with the standard SC install includes some, but not all of the Ugens and classes that come with bbcut. If you follow the install instructions that come with bbcut you'll end up with conflicts and the class library won't compile.
To get it to work you'll need to leave out the three ugens in the bbcut2 ugens folder and the machinelistening classes from the bbcut2 classes folder when moving the bbcut folders to your SC directory. These seem to be the source of the conflicts and if you copy over the rest of the files as described in the bbcut2 help file it should all be okay.
If you've already copied these into your SC folder you'll need to make sure you delete the version of the files that come with bbcut and replace the them with the versions that come with the standard SC download, they are different and only the ones from the standard SC download will work. And that's jazz.

I've no idea how this goes on other platforms but I imagine there might be similar problems.

à bientôt.

Sunday, October 18, 2009

Wicki - not wiki

Another soupçon of useful code from the SC-Users list, a Wicki keybord, as used by the Wicki system.
What's the Wicki system? I'm not entirely sure, but it seems to be a way of learning to play music with a type writer style keyboard. There's some background info available here and here.
This bit of code is a class that creates a Wicki keyboard, it is a bit long so I won't reproduce it on this blog, but you can download it here, along with a bit of test code. You can use the keyboard to record and playback sequences of notes, which are stored in an array, probably easier than typing frequencies or midi values directly into patterns and do things like transpose the entire sequence.
As with all SC classes you'll need to put it in the extensions folder and recompile the language before it'll work. The wickiTest file in the zip shows of some of the class methods, but it doesn't mention the startRecording and stopRecording methods. If you want to record an a array of notes you'll need to set it up by doing something like
and then
when you're done.