(
SynthDef("phase", { |freq = 440, modfreq = 600,
index = 3, modphase = 2, gate = 1|
var env1 = EnvGen.kr(Env.new([0.2,0.6,0.6,0.8,0.01, 0.2, 0.1, 0.01],[0.1,0.3,0.1,0.2], 'linear', 3, 6));
var pmosc = PMOsc.ar(freq,modfreq, index , modphase);
var out = MoogFF.ar(pmosc, 5000 * env1, 0.1);
Out.ar(0, Pan2.ar(out * EnvGen.kr(Env.new([0.1,0.5,0.3,0.6,0.7,0.8,0.7,0],[0.02,0.03,0.04,0.02,0.04,0.1,0.1],'linear', 2, 1), gate, doneAction:2)))
}).miditest(nil, [nil, [0, 100, \linear, 0, 2], [0, 20, \linear, 0, 2],
[0, 4, \linear, 0, 2], nil]);
)
Defining new envelopes is reasonably easy, the help file explains most of it very well, but the release node and looping function took me a while to work out.
When you create a new envelope with Env.new you can give it a release node, this is the value of the envelope that will be held until the note is released. If you've got a envelope handyly defined like this (the first array is the list if output values, the second is the time it takes to transition to the next one)
Env.new([1,2,3,4,5] , [1,2,3,4]. 'linear', 5]
the note will be held at the first value on the list, '5' in this case, until it's released.
If you define a loop node like this
Env.new([1,2,3,4,5] , [1,2,3,4]. 'linear', 5, 1]
When the note is held it will loop through the nodes starting at the loop node and ending at the node before the release node untill the note is realsed. So in this case when the note is held, the values put out by the envelope will loop through the values '1, 2, 3, 4' as long as the note is held and then transition to '5'when it's released. I think.
And that's jazz.
No comments:
Post a Comment