Tuesday, March 10, 2009

The Joy of Frequecy Modulation

Here's a simple frequency modulating synth def I came up with, 


(
SynthDef(\efemer, {|freq = 240, modlev1 = 100, modlev2 = 100,
carlev = 1, pulsewidth = 0.5, mod1osctype = 1,
mod2osctype = 2 , carosctype = 2, sinphase = 0|

var mod1array = [Saw.ar(freq, modlev1), Pulse.ar(freq, pulsewidth, modlev1),
SinOsc.ar(freq, sinphase, modlev1)];

var mod1 = Select.ar(mod1osctype, mod1array);

var mod2array = [Saw.ar(freq + mod1, modlev2),
Pulse.ar(freq + mod1, pulsewidth, modlev2),
SinOsc.ar(freq + mod1, sinphase, modlev2)];

var mod2 = Select.ar(mod2osctype, mod2array);

var cararray = [Saw.ar(freq + mod2, carlev),
Pulse.ar(freq + mod2, pulsewidth, carlev),
SinOsc.ar(freq = mod2, 1, carlev)];

var car = Select.ar(carosctype, cararray);
var env = EnvGen.ar( Env.perc(0.11, 1), doneAction: 2);

Out.ar(0, Pan2.ar(car * env))
}).store
)


(
Pbind(\instrument, "efemer",
\mod1osctype, Pseq([0,1,2], inf),
\freq, Pseq([220,330,440,550], inf),
\dur, 0.3
).play
)



I think it need's some work.

No comments:

Post a Comment