Monday, October 28, 2013
Installing SuperCollider on Windows 7 and 8 and dealing with 'Device unavailable' could not initialize audio'
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.
(
SynthDef("aSynth",{
arg lagLev = 0.2, freq= 440, cutoff = 500, gate = 0.5;
var osc1 = Mix.fill(8, { SinOsc.ar(freq + 10.0.rand, 0, 0.05) }); var filterEnv = EnvGen.ar(Env.adsr(0.02, 0.1, 0.05, 1), gate, doneAction:2);
var filterOutput = MoogFF.ar(osc1, cutoff * filterEnv, 3.3); Out.ar(0, filterOutput);
}).store
)
(
PmonoArtic("aSynth",
\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)
).play
)
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, { SinOsc.ar(freq + 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 Mix.new(array) 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.
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.
{SinOsc.ar(MouseY.kr(1,880),SinOsc.kr(MouseX.kr(0,100)))}.play
Wednesday, April 20, 2011
I'm still alive.
Monday, November 30, 2009
'Harmoniser' with Tartini
(
SynthDef("Harm", {|offSet1, offSet2, output, osc1, osc2, mix, pitch1, pitch2, fader|
var sound = SoundIn.ar;
var pitch = Tartini.kr(sound)[0];
var amp = Amplitude.ar(sound);
pitch = Median.kr(5, 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 = Saw.ar(pitch1, amp * 2); // resynthesise
osc2 = Pulse.ar(pitch2, 0.2, amp * 2);
mix = Mix.ar([osc1, osc2]);
fader = XFade2.ar(sound, mix, -0.5);
output = FreeVerb.ar(fader, 0.3, 0.1, 0.9); // bit of reverb just to taste
Out.ar(0, output);
}).memStore;
)
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
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
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
m.startRecording
and then
m.stopRecording
when you're done.