Csound documents are plain text files. These text files contain instructions that are passed to a sound-producing engine. The engine ignores any line of text that is preceded by a semi-colon. Such lines are called ‘comments’ and their main purpose is to allow the programmer to annotate his or her code.

The actual code begins with a ‘CsoundSynthesizer’ opening header, which is surrounded by angle brackets. Such headers outline the overall structure of the document and must always be closed by an almost identical header, only preceded by a forward slash. Go check the end of the document to find the closing header ‘</CsoundSynthesizer>’.


After the ‘CsoundSynthesizer’ header, we usually declare rendering options, such as which sound card we would like to use, or whether we are producing notes through a MIDI device. For that we use the ‘' statement and its closing counterpart. In this beginners tutorial, we will not declare any options, so we will close the options header right away.


; Options go here :-)


The next structural section of a Csound document is the instruments header. Inside this section, which is called the orchestra, we can construct however many instruments we like.


A Csound instrument always begins with the ‘instr’ orchestra statement, followed by the name we choose to give to that particular instrument. It is most convenient to call our instruments by numbers. In this case, we are constructing instrument 1.

instr 1

For this tutorial, instrument 1 will only produce a sine wave with a raw amplitude of 10000 (more on amplitude values later) and a frequency of oscillation of 440 herz. We are going to call this signal ‘asig’, where the ‘a’ preceding ‘sig’ is mandatory and stands for audio rate (more on signal rates later). The ‘sig’ portion of the name can be changed arbitrarily, however. The sound processor, or opcode, that will generate this simple signal is called ‘oscil’, and it takes three parameters: amplitude (10000), frequency (440), and waveform, which in this case is a function we are now naming ‘1’ and that will be declared below.

asig oscil 10000, 440, 1

Without processing our signal any further, we pass it as is to the output of the instrument, which is given by the opcode ‘out’. Note that the name of the signal, when first declared, is placed at the left of the opcode. When names are seen at the right of an opcode, that is because they are being passed as arguments instead.

out asig

To tell Csound that we are done declaring this instrument, we must close it using the orchestra statement ‘endin’.


Since we do not have any more instruments to declare, we close the instruments header.


The next structural section of a Csound document is the score. In it, we declare all the functions and arguments our instruments are going to use. These include when each instrument should start playing and for how long.


Immediately after opening the score header, we declare the function ‘1’ we previously specified in instrument 1. The line below reads: “function 1 starts at index 0, has length 1024 points, is drawn by GEN 10 (more on generators later), and its fundamental frequency has amplitude 1.

f 1 0 1024 10 1

We next determine the behavior of our instruments in the context of the piece. For this example, instrument 1 will start playing at 0 seconds into the piece and keep playing for 2 seconds. Compile the file to hear the result!

i 1 0 2

When the piece is over, we must close the score header.


And since the score is the last structural section of this Csound document, we immediately thereafter close the whole synthesizer.


News & Events

Subscribe at the bottom of the page to be informed of news as they arrive.

RunloopSound Released on the App Store

Aug 12, 2016

RunloopSound brings the world of Csound to iOS devices. With a gorgeous user interface and complete integration to all major cloud providers, RunloopSound allows you to keep designing incredible sounds wherever you go.

Read more

Unbalanced Connection 57

Feb 19, 2016

The Unbalanced Connection is a semiannual series of concerts hosted by the University of Florida and dedicated to electroacoustic music.

Read more

Society of Composers, Inc.

Mar 15, 2014

Read more

O Guri Takes Over Portugal!

Oct 8, 2012

Read more

Première of O Guri in Bagé

Jul 7, 2011

O Guri is a feature film directed by Zeca Brito whose original music was written by me.

Read more