Csound Csound-dev Csound-tekno Search About

Opcodes

Date1997-12-07 07:17
FromChristopher Neese
SubjectOpcodes
I hope this message gets through OK; the last time I posted my messages were delayed about five days.

ABOUT OPCODES:

This message is aimed at beginners.  Hans Mikelson's Introduction to Csound should be a great help to beginners, but there is one point that needs elucidation.  Both the score and the orchestra make use of opcodes, and this can lead to confusion when the manual talks about opcodes.

The score opcodes are the first letter on each line of the score.  The legal score opcodes are f, i, a, t, s, and e.
Score opcodes are always single alphabetic characters.

On the other hand, a orchestra opcode is an alphanumeric string, such as oscil.  It is confusing that both score opcodes and orchestra opcodes are simply referred to as opcodes in the manual.

For those of you that need a justification for this [like me 8-)], suffice it to say that the word opcode has a specific meaning in computer science.  Both score opcodes and orchestra opcodes are opcodes in this sense.  However, score and orchestra opcodes are not interchangeable, just as English words are usually not interchangeable with Latin words.

I hope this clears some of the terminology in the manual up.

MORE ON THE FORMAT OF AN ORCHESTRA:

The following may be more confusing than helpful to some beginners, but it should help some.

Every line in a Csound score, ignoring blank lines, and lines with just labels and/or comments is a statement.  Most Csound statements have the following form:

Variables Opcode Expressions

Variables is a list of zero or more variables delimited by commas.

Opcode is an orchestra opcode (see above)

Expressions is a list of zero or more expressions delimited by commas.

In addition, every line can be prefaced with a label (followed by a colon) and ended with a comment (started with a semi-colon).  Program control statements are the sole exception to this form.

What variables and opcodes are should be fairly clear.  However, the concept of an expression in terms of a Csound orchestra may be a source of confusion.  An expression is a combination of functions, arithmetic operators, conditional operators, and variables.  The important thing here is that opcodes do not evaluate as expressions.  Opcodes and functions are not the same thing.  (again, this is consistent with computer science vocabulary).  In the Csound manual functions are also known as value converters and pitch converters.

I hope this message is helpful.  Good luck!

Christopher Neese