Syntax of the Orchestra

An orchestra statement in Csound has the format:

      label:   result opcode argument1, argument2, ... ;comments
    

The label is optional and identifies the basic statement that follows as the potential target of a go-to operation (see Program Flow Control). A label has no effect on the statement per se.

Comments are optional and are for the purpose of letting the user document his orchestra code. Comments always begin with a semicolon (;) and extend to the end of the line.

The remainder (result, opcode, and arguments) form the basic statement. This also is optional, i.e. a line may have only a label or comment or be entirely blank. If present, the basic statement must be complete on one line, and is terminated by a carriage return and line feed.

The opcode determines the operation to be performed; it usually takes some number of input values (or arguments, with a maximum value of about 800); and it usually has a result field variable to which it sends output values at some fixed rate. There are four possible rates:

  1. once only, at orchestra setup time (effectively a permanent assignment)

  2. once at the beginning of each note (at initialization (init) time: i-rate)

  3. once every performance-time control loop (perf-time control rate, or k-rate)

  4. once each sound sample of every control loop (perf-time audio rate, or a-rate)

Directories and Files

Many generators and the Csound command itself specify filenames to be read from or written to. These are optionally full pathnames, whose target directory is fully specified. When not a full path, filenames are sought in several directories in order, depending on their type and on the setting of certain environment variables. The latter are optional, but they can serve to partition and organize the directories so that source files can be shared rather than duplicated in several user directories. The environment variables can define directories for soundfiles SFDIR, sound samples SSDIR, sound analysis SADIR, and include files for orchestra and score files INCDIR.

In Csound version 5.00 and later, these environment variables can specify multiple directories as a ; separated list. If a file is found in more than one location, the last one has the highest precedence.

The search order is:

  1. Soundfiles being written are placed in SFDIR (if it exists), else the current directory.

  2. Soundfiles for reading are sought in the current directory, then SSDIR, then SFDIR.

  3. Analysis control files for reading are sought in the current directory, then SADIR.

  4. Files of code to be included in orchestra and score files (with #include) are sought first in the current directory, then in the same directory as the orchestra or score file (as appropriate), then finally INCDIR.