ScoreFile provides its own set of operators in addition to supporting a subset of C arithmetic operators. The following table shows all the available operators in order of decreasing priority. The operators unique to ScoreFile are discussed below.
Table 7-3. Summary of Operators
Operator | Operation |
---|---|
( ) | Grouping |
- | Unary minus |
dB | Decibel computation |
^, ~ | Exponentiation, pitch transposition |
*, /, % | Multiplication, division, modulus |
+, - | Addition, subtraction |
@ | Envelope lookup |
& | String concatenation |
= | Assignment |
, | Sequence separator |
The modulus operator doesn't work in Release 1.0. |
The postfix decibel operator dB is used to specify an amplitude value in units of decibels:
expression dB |
The computation used by the dB operator is:
10(expression /20)
0 dB is the maximum amplitude.
In ScoreFile, the expression:
expression ^ expression |
calculates the left expression raised to the power of the right expression.
The pitch transposition operator ~ is designed to transpose a pitch variable:
pitchVariable ~ expression |
The computed value is the frequency of pitchVariable raised or lowered by expression half-steps (a negative value lowers the pitch). The pitch variable's value isn't affected.
The Envelope lookup operator @ retrieves a discrete value from an envelope:
envelopeName @ xValue |
The calculation returns the y value in envelopeName that corresponds to xValue. The operation performs a linear interpolation between breakpoints, if necessary.