MKEnvelope Class MKEnvelopes are (x,y,z)
triplets:
x ― time in seconds. The first x value is usually 0.
y ― value
z ― smoothing value (rarely used)
An envelope may have a “stickpoint”. The envelopes stops at the
stickpoint until the noteOff or the end of its
duration.
Example scorefile: [(0,0)(.1,1)(2.1,.5) | (2.7,.1)(3,0)];
Same example in Objective-C
MKEnvelope *env;
double times[] = {0, 0.1, 2.0, 2.7, 3.0};
double values[] = {0, 1, 0.5, 0.1, 0};
env = [MKEnvelope new]; /* or alloc/init in 2.0 */
[env setPointCount:5 xArray:times yArray:values];
[env setStickPoint:2]; /* zero-based */
|
Some MKSynthPatches (software
DSP instruments) also support attack and
release parameters. If present, they override the times in the
MKEnvelope. E.g. if attack is 0.1 in
example above, the envelope times becomes {0,.005,0.1...}
Scaling parameters are also common. E.g. freq1 for value when frequency envelope is 1 and freq0 for value when frequency envelope is 0.
The EnvelopeEd program (included in the MusicKit distribution) helps design envelopes.