ScoreFile reserves a number of words as predefined pitch variables. Pitch variables represent the frequencies of pitches over a ten and a half octave range. A pitch variable name takes the following form (spaces between components aren't allowed):
pitchLetter[sharpOrFlat]octave |
pitchLetter is a lowercase letter from a to g.
sharpOrFlat is s for sharp and f for flat. (Double sharps and double flats aren't supported.)
octave is 00 or an integer from 0 to 9. Octaves are placed such that c4 is middle C. c00 is the lowest pitch, g9 is the highest.
The “break” is at C. That is, b4 is B above middle C. b3 is a half-step below c4. bf4 is bf4 above middle C. cf4 is the same as b3. bs3 is the same as c4.
A pitch variable can be assigned an arbitrary value in an assignment statement or assignment expression. The value assigned to a pitch variable is taken as a frequency in hertz:
pitchVariable = expression ; |
By assigning a value to a pitch variable, only the value of that pitch variable is changed; this is different from using a pitch variable in a tune statement, where all pitch variables of the same pitch class are affected.
Key numbers are similar in appearance to pitch variables, but have an appended k (again, embedded spaces aren't allowed):
pitchLetter[sharpOrFlat]octavek |
Unlike a pitch variable, which represents a frequency, a key number is an integer that represents the ordinal number of a key on a MIDI synthesizer.
A number of MIDI constants defined as values for MIDI parameters are provided by ScoreFile:
resetControllers
localControlModeOn
localControlModeOff
allNotesOff
omniModeOff
omniModeOn
monoMode
polyMode
sysClock
sysStart
sysContinue
sysStop
sysUndefined0xf9
sysUndefined0xfd
sysActiveSensing
sysReset
ScoreFile defines two special symbols, t and ran. These are read-only variables that should never be assigned a value in an assignment statement. The t symbol was described in the Section called Time Statements, earlier in this chapter.
ran is a random number (a double) between 0 and 1. The seed for the random number generator is randomly set to produce a different series of random numbers every time the file is read.