4. The Score File
Here is a complete score file with which you can play the orchestra you built in the previous section. It creates a function table f1 of sound samples which the instrument i1 produces for 4 seconds.
f1 0 4096 10 1 0 .333 0 .2 i1 0 4 e ; marks the end of the score file
Function tables create and store the sets of values you wish your instruments
to use. All function tables, or f-statements, share a similar structure:
;func# | start | table_size | GEN_routine | [Addditional GEN-defined parameters] |
f1 | 0 | 4096 | 10 | 1 0 .333 0 .2 etc... |
This function becomes available to the orchestra at time 0, holds 4096 separate values, and uses GEN routine 10 (a Fourier sine series) to fill that table. All of the numbers after the GEN routine are proper to that generator and you have to find them someplace. Here, for example, they are the first, third and fifth coefficients for the fundamental and its first 2 (odd) partials. The even partials are zeroed out. Since the coeffients are decimals for 1:1/3:1/5 you can guess the sound? If not, you should definitely listen to it soon.
Generating note lists (i-statements)
The main functions of a score file are to sequence the instruments into a musical
work. This is accomplished by the use of note lists, or i-statements.
I-statements contain the following parameters:
;i | inst # | start time | duration | [user-defined parameters] |
i | 1 | 0 | 2 | ... |
i | 1 | 2.5 | 3 | ... |
The first three parameters in an i-statement will always stand for instrument number (from the orchestra file), start time, and duration in seconds (or adjustable "beats"). All of these parameters correspond to the p-fields in the orchestra file. You could skip ahead here, to Section 8, to see a less trivial composition. Click here to see a demonstration of complex instrument design in the orchestra file and its use in the score file.
Other score statements
The score file contains more than function tables and instrument lists. For exact statement definitions, consult the Csound reference manual. Beginners may find the following score statements helpful in score processing:
t-statements affect the tempo of the piece. Its proper usage is:
t | 0 | tempo0 | time1 | tempo1 | time2 | tempo2 | etc... |
The time is not in seconds, but in beats--the frequency of which is determined by the tempo. The tempo will shift linearly from tempo1 to tempo2 over the course of time(2-1), and so on. To make an immediate tempo shift, create one time with both the old and new tempos (ex. t 0 60 8 60 8 90). The t-statement is usually made at the beginning of each section, and it applies only for that section.
s-statements mark the end of a section of music. Any section-specific statements (such as tempo) are reset to default, and the clock resets to zero. There are no parameters with this statement, and a composer may use "e" to mark the end of the last section in the score.
r-statements are used at the beginning of a section to repeat that section a specified number of times. A value of r 3, for example, will repeat the following notes (up to an s- or e-statement) 3 times. Additionally, a macro can be included after the r-statement. The macro takes the value of whichever pass the section of music is currently on. This is most useful to change p-field parameters for different passes through the repeated section.
m- and n-statements are used to mark a section of music one can return to later in the score. The m-statement is used at the beginning of a section to mark that section, and the n-statement is used at a later part in the score to repeat that marked section. Proper usage in the score file is m arg, where arg is any number or word. One must use the s-statement to mark the end of each of these sections.
Warning: I have found that when using m-,n-, or r-statements, one must include a "dummy" statement immediately afterwards. This can be an empty i-statement, or even a line of comments, but if this line is not included, then the first i-statement does not get read properly.
Score preprocessing
Writing note lists can be a tedious way of sequencing a piece of music. Csound includes a number of preprocessor commands the composer can use as shortcuts. The most common preprocessor commands are described below:
Carry
A period (.) can be used in place of a p-field entry when that entry is
the same as the preceding one. Example:
;inst | strt | dur | amp |
|Is
interpreted as|
|
;inst | strt | dur | amp |
i1 | 0 | 2 | 15000 |
||
|
i1 | 0 | 2 | 15000 |
i1 | 3 | . | . |
||
|
i1 | 3 | 2 | 15000 |
i1 | 5.5 | . | 7500 |
||
|
i1 | 5.5 | 2 | 7500 |
i1 | . | 1.5 | . |
||
|
i1 | 5.5 | 1.5 | 7500 |
Add
Placing a plus sign (+) in the p2 field of the score is taken to mean "Add
the previous values of the p2 and p3 fields, and place that result here."
This entry is only valid in the p2 (start time) field. Example:
;inst | strt | dur | amp |
|Is
interpreted as|
|
;inst | strt | dur | amp |
i1 | 0 | 1 | 15000 |
||
|
i1 | 0 | 1 | 15000 |
i1 | + | . | . |
||
|
i1 | 1 | 1 | 15000 |
i1 | . | . | 12500 |
||
|
i1 | 2 | 1 | 12500 |
i1 | . | .5 | 13500 |
||
|
i1 | 3 | .5 | 13500 |
i1 | + | 2 | 14500 |
||
|
i1 | 3.5 | 2 | 14500 |
Ramp
A p-field value with the less than symbol (<) will replace that value with
those derived from linear interpolation between two specified points. A ramp
symbol is only valid in the user-defined parameters (p4 or greater), and there
must be two real numbers within the section anchoring the interpolations. Example:
;inst | strt | dur | amp |
|Is
interpreted as|
|
;inst | strt | dur | amp |
i1 | 0 | 1 | 15000 |
||
|
i1 | 0 | 1 | 15000 |
i1 | + | . | < |
||
|
i1 | 1 | 1 | 13000 |
i1 | . | . | < |
||
|
i1 | 2 | 1 | 11000 |
i1 | . | . | < |
||
|
i1 | 3 | 1 | 9000 |
i1 | . | . | 7000 |
||
|
i1 | 4 | 1 | 7000 |
i1 | . | . | < |
||
|
i1 | 5 | 1 | 9500 |
i1 | . | . | 11000 |
||
|
i1 | 6 | 1 | 11000 |
If one replaces the ramp symbol with the symbols '(' or ')', the result will be an exponential interpolation. The symbols '{' or '}' will result in an exponential interpolation that has been depracated. The symbol '~' will result in a uniform, random distribution between the anchor values of the ramp.
Sort
I-statements within sections of the score file will always be sorted by the
p2 value (start time). Therefore, one can group note lists by instrument, rather
than by start time. If two instruments have the same p2 value, they will be
sorted in order of ascending p1 value, then by ascending p3 value. F-statements
always have precedence over i-statements beginning at the same time.
Return to Table of Contents.