Operators

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

OperatorOperation
( )Grouping
-Unary minus
dBDecibel computation
^, ~Exponentiation, pitch transposition
*, /, %Multiplication, division, modulus
+, -Addition, subtraction
@Envelope lookup
&String concatenation
=Assignment
,Sequence separator

Important

The modulus operator doesn't work in Release 1.0.

Decibel Computation Operator

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.

Exponentiation Operator

In ScoreFile, the expression:

expression ^ expression

calculates the left expression raised to the power of the right expression.

Pitch Transposition Operator

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.

Envelope Lookup Operator

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.

String Concatenation Operator

The string concatenation operation takes the form:

expression & expression

The two expressions are converted to text and concatenated to produce a new string, regardless of the data types of the original expressions.

Character Extraction

Beginning with Release 3.0, ScoreFile language supports character extraction from a string. For example: "abc"[2] is equal to the string "c". No other array access or definition is currently supported.