When a scorefile is read by an application, a single MKNote object is created for each note statement in the file. MKNote statements take the following form:
partName , ( typeAndTag ) [ , parameters ] ; |
partName is the name of the MKPart to which the MKNote belongs. It must be declared in a part statement in the header.
typeAndTag provides noteType and noteTag information; its form depends on the noteType:
For a noteDur, it takes the form:
( duration [ noteTag ] ) |
duration is a double expression that specifies the duration of the MKNote in beats; noteTag is an integer expression that assigns the MKNote's noteTag.
For a noteOn or noteOff, the noteTag is required:
( noteOn noteTag ) |
( noteOff noteTag ) |
The noteTag is optional for a noteUpdate:
( noteUpdate [ noteTag ] ) |
A noteUpdate with a noteTag is applied to the specified noteTag stream. Without a noteTag, it's applied to all noteTag streams that are currently being realized on the same MKInstrument as the noteUpdate.
Finally, a mute never takes a noteTag:
( mute ) |
parameters is a list of parameters separated by commas. A parameter takes the form:
parameterName : expression |
parameterName is the name of the parameter. Its form is that of a MusicKit parameter identifier minus the “MK_” prefix. For example, MK_freq becomes, in a scorefile, freq. In a scorefile you can create your own parameters simply by including them in a note statement. When the scorefile is read by an application, a parameter identifier is automatically created and named for each of your invented parameters.
expression is computed as the value assigned to the parameter. An expression can include variable assignments:
parameterName : ( variable = expression ) |
A time statement specifies the performance time in beats for all subsequent MKNote statements until another time statement is encountered. A time statement takes the form:
t [ + ] expression ; |
The keyword t is a special symbol; its value is the current time, in beats, in the scorefile. At the start of the scorefile, the value of t is 0.0. If expression is preceded by +, t is incremented by the value of expression. Otherwise, t takes the value of expression directly. Time always moves forward in a scorefile―the value of t must never decrease.
t can be used as a read-only variable in an expression.