Friday, March 20, 2009

Midievalism - Midi control

James Harkins' Dewdrop_lib , has an armada of wonderful surprises for the budding SuperCollidist, including several classes for dealing with midi stuff. 

This is part of the official extensions package, but you'll still need to install the quark and recompile the language for it to work. 

A useful method is .miditest, which you can append to any synthdef and automatically create a simple midi interface and a gui to control it. It's very simple to use and the help file is easy to understand. 

Here's an example of a simple phase modulating synth I made. The synth itself is pretty simple, I'm just using sin oscillators to modulate the phase of another SinOsc. 


(
SynthDef("phase", { |freq = 440, pm1f = 2,
pm2f = 2, pm3f = 2, gate = 1|

var out =
SinOsc.ar(freq, SinOsc.ar(pm1f, SinOsc.ar(2, SinOsc.ar(pm2f,
SinOsc.ar(pm3f))))*2pi);
Out.ar(0, Pan2.ar(out * EnvGen.kr(Env.adsr, gate, doneAction:2)))
}).miditest(nil, [nil, [0, 50, \linear, 0, 2], [0, 50, \linear, 0, 2],
[0, 50, \linear, 0, 2], nil]);

)



To make miditest work correctly you'll need to supply it control specs for each of the parameters of your synth in the second argument. If any of your paremeters don't need to be controlled by the gui, putting nil as the argument will cause it to be left out.

No comments:

Post a Comment