Getting Started with Csound

Downloading

In case you don't already have Csound (or have an older version) download the appropriate Csound version for your platform from the Sourceforge Csound5 Download Page. Installers for Windows have '.exe' extension and for Mac '.dmg' or '.tar.gz'. If the installer's filename ends in '-d' it means the installer has been built with double precision (64-bit) which provides higher quality output than the ordinary float precision (32-bit), which provides quicker output. You can also download the sources and build them, but this requires more expertise (See the section Building Csound).

It's also useful to download the most recent version of this manual, which you will also find there.

Running

Csound can be run in different ways. Since Csound is a command line program (DOS in Windows terms), just clicking on the csound executable will have no effect. Csound must be called either from a terminal (or DOS prompt), or from a front-end. To use Csound from the command line, you must open a Terminal (DOS prompt on Windows). Using Csound from the command line can be hard if you've never used the terminal, so you may want to try to use one of the front-ends included with your distribution. A front-end is a graphical program that assists running Csound and can usually help edit csound files.

Both in the case of front-ends as well as execution from the command line, Csound needs two things:

See the section Configuring if Csound is giving you trouble.

This documentation includes many '.csd' files which you can try out, and which should work directly from the command line or from any frontend. A simple example is oscil.csd that can be found in the examples folder of this documentation. Your front-end should allow you to choose the file, and it should have a 'play' or 'render' button.

[Note] Note for MacCsound users
You might need to remove all the lines from the command options slot in order for the manual examples to work.

You can also try the manual examples from the command line by navigating to the examples directory of the manual using something like this on Windows (assuming the manual is located at c:\Program Files\Csound\manual\):

cd "c:\Program Files\Csound\manual\examples"

or something like:

cd /manualdirectory/manual/examples

for the Mac or linux terminals and then typing:

csound oscil.csd

The example files are configured to run in realtime by default, so you should have heard a 2 second sine wave.

Writing your own csd files

A .csd file looks like this (this file is oscils.csd):

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
; Audio out   Audio in    No messages
-odac           -iadc     -d     ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o oscils.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1 - a fast sine oscillator.
instr 1
  iamp = 10000
  icps = 440
  iphs = 0

  a1 oscils iamp, icps, iphs
  out a1
endin


</CsInstruments>
<CsScore>

; Play Instrument #1 for 2 seconds.
i 1 0 2
e


</CsScore>
</CsoundSynthesizer>

  

Csound's .csd files contain 3 main sections contained within <CsSynthesizer> and </CsSynthesizer> tags:

Note that anything after a semicolon (;) until the end of the line is a comment, and is ignored by csound.

You can write csd files in any plain text editor like notepad or textedit. Just be sure to save the file as plain text (not rich text). Many frontends include advanced editing capabilities with syntax highlighting and completion.

You can find an in depth tutorial on getting started with Csound written by Michael Gogins here.