Wednesday, April 8, 2009

Moog miditest

More work on my Moogy synth, nothing too spectacular, once again I've made use of .miditest from Dewdrop_lib. I've just invoked the miditest method and added control specs for all the parameters. This is the 'lfo' amplitude modulation version of my synth, the oscType sliders let you select from the 12 possible combinations of saw, sin and pulse waves with trinagle, sin or pulse wave amplitude modulation.

( 
SynthDef("Moog",{

arg oscType =0, oscType2 = 0, pan = 0, level = 0.5, cutoff = 500, gain = 3.3, attack = 0.1, decay = 0.1, sust = 0.7, rel = 0.2, attackf = 0.1, decayf = 0.1, sustf = 0.9, relf = 0.2, gate = 1, freq =440, lfo1Rate = 12, lfo2Rate =4, lfo3Rate = 6;

var lfo1 = Lag2.kr(LFSaw.kr(lfo1Rate), 0.1);
var lfo2 = Lag2.kr(LFTri.kr(lfo2Rate), 0.1);
var lfo3 = SinOsc.kr(lfo3Rate);

var oscArray = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq),Saw.ar(freq, lfo1), SinOsc.ar(freq,0, lfo1), Pulse.ar(freq, 0.5,lfo1), Saw.ar(freq,lfo2), SinOsc.ar(freq, 0,lfo2), Pulse.ar(freq, 0.5,lfo2), Saw.ar(freq, lfo3), SinOsc.ar(freq,0, lfo3), Pulse.ar(freq, 0.5, lfo3)];
var oscArray2 = [Saw.ar(freq), SinOsc.ar(freq), Pulse.ar(freq),Saw.ar(freq, lfo1), SinOsc.ar(freq,0, lfo1), Pulse.ar(freq, 0.5,lfo1), Saw.ar(freq,lfo2), SinOsc.ar(freq, 0,lfo2), Pulse.ar(freq,0.5,lfo2), Saw.ar(freq, lfo3), SinOsc.ar(freq,0, lfo3), Pulse.ar(freq, 0.5, lfo3)];

var ampEnv = EnvGen.ar(Env.adsr(attack, decay, sust, rel), gate, doneAction:2);
var filterEnv = EnvGen.ar(Env.adsr(attackf, decayf, sustf, relf), gate, doneAction:2);
var osc1 = Select.ar(oscType, oscArray);
var osc2 = Select.ar(oscType2, oscArray2);
var fade = Pan2.ar(XFade2.ar(osc1, osc2, pan , level * ampEnv, 0));
var filter = MoogFF.ar(fade, cutoff * filterEnv, gain);
Out.ar(0,filter)

}).miditest(nil, [[0, 11, \linear, 1, 0, 1], [0, 11, \linear, 1, 0, 1], [-1, 1, \linear, 0.1, 0, 0.1], [0, 4, \linear, 0.1, 1, 0.1], [0, 10000, \linear, 0.1, 5000, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],[0, 4, \linear, 0.1, 1, 0.1],nil, nil, [0, 50, \linear, 0.1, 1, 0.1],[0, 50, \linear, 0.1, 1, 0.1], [0, 50, \linear, 0.1, 1, 0.1]])
)


By the way, I use MidiKeyswith OS X to play midi notes with an ordinary alphanumeric keyboard. Very handy and SuperCollider recognises it without any trouble.
This appears to be a Windows substitute but I've no idea what it's like and it might be a pain in the arse to get working. If you're running linux you're on your own.

No comments:

Post a Comment