MusicKit and SndKit Concepts | ||
---|---|---|
Prev | Chapter 8. From The Classical Software Synthesis Note-List to the MusicKit Scorefile | Next |
A note cannot be addressed from the classical note-list once the note has begun. It is not possible, for example, to alter the parameter of a note once it has started playing. This means all continuous change must be built into the instrument and specified in advance via envelopes. But in a real-time situation, such as MIDI or any interactive application, the future is not known and cannot be predicted.
MIDI solves the problem with its special “continous controllers” that must be interpreted by the synthesizer. The scorefile is even more flexible. It allows any parameter of a note that's already playing to be changed at any time, simply by specifying the noteType as noteUpdate and giving the appropriate noteTag. In this example the note goes sharp and its amplitude is increased:
Example 8-6. Note Updating
guitar (noteOn,1) freq:c4 amp:.1 t +2; guitar (noteUpdate,1) amp:.3 freq:cs4; t +2; guitar (noteOff,1); |
Scorefiles can also represent envelopes. Envelopes are defined as (X,Y) pairs (with an optional Z parameter that represents “smoothing”).
For example here's an envelope definition:
envelope martele = [(0,0)(.1,1)(.6,.2)|(1.0,0)]; |
The X values are in seconds, independent of the tempo. The portion up to the stick point (represented as a vertical bar “|”) is called the “attack portion”. Tempo variations do not cause attack times to be distorted. The reasoning here is that the attack of an acoustic instrument, such as a xylophone, is invariant with respect to tempo.
The portion after the vertical bar is called the “decay portion”. There is no absolute limit to the number of points in an envelope. Both the attack and the decay portions may have any number of points.
The envelope progresses as follows: It proceeds until the stick point (at .6 seconds after the onset, with a Y value of .2) and then waits until the noteOff (or, for a noteDur, the end of the duration). Then it proceeds with the final segment(s). For example, if the note has a duration of 4, the final segment begins after 4 beats and the decay takes .4 seconds. Alternatively, an optional attack time and decay parameter may be supplied for each envelope in a note. These scale the X values in the envelope definition. For example, if martele is used as an amplitude envelope and ampAtt, the amplitude attack parameter, is equal to .1, the resulting envelope X values will be 0, .01, .06. The release portion may similarly be scaled. Here is an example of a note that uses the ampAtt and ampRel parameters.
weaslePhone (4) amp:.3 ampEnv:martele ampAtt:.1 ampRel:6.0; |
The amp parameter does scaling on the envelope values. Actually, amp is really a synonym for amp1, the value of the amplitude when the envelope is at 1.0. There is also an optional parameter amp0, that signifies the value of the amplitude when the envelope is at 0. This convention is followed uniformly for all parameters that take envelopes. For example, a frequency envelopes parameters are freq0,freq1, freqAtt, freqRel, and freqEnv.