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.

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.


{SinOsc.ar(MouseY.kr(1,880),SinOsc.kr(MouseX.kr(0,100)))}.play