FLOSS Manuals

 English |  Español |  Français |  Italiano |  Português |  Русский |  Shqip

CSOUND

MAKE CSOUND RUN

Csound and Frontends

The core element of Csound is an audio engine for the Csound language. It has no graphical interface and it is designed to take Csound text files (called ".csd" files) and produce audio, either in realtime, or by writing to a file. It can still be used in this way but most users nowadays prefer to use Csound via a frontend. A frontend is an application which assists you in writing code and running Csound. Beyond the functions of a simple text editor, a frontend environment will offer colour coded highlighting of language specific keywords and quick access to an integrated help system. A frontend can also expand possibilities by providing tools to build interactive interfaces (GUI widgets) as well, sometimes, as advanced compositional tools.

In 2009 the Csound developers decided to include CsoundQt as the standard frontend to be included with the Csound distribution, so you will already have this frontend if you have installed any of the pre-built versions of Csound. Conversely if you install a frontend you will usually require a separate installation of Csound in order for it to function. If you experience any problems with CsoundQt, or simply prefer another frontend design, try Cabbage, WinXound or Blue as alternatives. Section 10 of this manual provides more information about the frontends.

How to Download and Install Csound

To get Csound you first need to download the package for your system from the SourceForge page:  http://sourceforge.net/projects/csound/files/csound6

There are many files here, so here are some guidelines to help you choose the appropriate version (the download section of the Csound home page may also help).

Windows

Windows installers are the ones ending in .exe. Look for the latest version of Csound and find a file which should be called something like: Setup_Csound6_6.07.0beta.exe.

After you have downloaded the installer simply double-click it start the installation process. This will invoke 8 simple steps:

  1. A welcome screen advises you to close other programs.
  2. After reading and accepting the licence agreement click 'Next'.
  3. Select the destination for the Csound program files. The default is C:\Program Files (x86)\Csound6.
  4. Choose the components to be installed. Currently (ver. 6.07) there are only 3 items: Core Csound is obligatory. Python features are optional but will be required if you intend to use CsoundQt as a frontend for Csound. You will also need to install Python 2.7. Pure data Csound~ object will allow you to run Csound from within Pure Data. To do this will require installing Pure Data.
  5. Select Start Menu Folder allows you to define a folder name other than the default 'Csound 6' for the folder containing the various Csound components. Alternatively you can choose not to create a start menu folder. 
  6. Next there is an option to add the Csoound application directory to your PATH variable. Adding this will allow you to run Csound from the command line from any directory location.
  7. Next a window reminds you of what will be installed and what changes will be made to your system.
  8. Upon clicking install the installation takes place.
  9. A window informs you that installation is complete. You can click 'Finish'.

This installer will also automatically install CsoundQt which can be used as a frontend for your work with Csound (Csound is not run by double-clicking Csound.exe). 

You can create addional shorcuts to the CsoundQt executable by locating it in its default location, C:\Program Files (x86)\Csound6\bin, and right-clicking it and selecting 'Pin to Start' or 'Pin to Taskbar' as desired. You can create a desktop shortcut by right-clicking and dragging the CsoundQt executable onto the desktop and selecting 'Create Shortcuts Here' from the menu that pops up.   

Other frontends for Csound, such as Cabbage and WinXound, need to be downloaded and installed separately.

Mac OS X

The Mac OS X installers are the files ending in .dmg. Look for the latest version of Csound for your particular system, for example a Universal binary for 10.9 will be called something like: csound6.06-OSX-universal.dmg. When you double click the downloaded file, you will have a disk image on your desktop, with the Csound installer, CsoundQt and a readme file. Double-click the installer and follow the instructions. Csound and the basic Csound utilities will be installed. To install the CsoundQt frontend, you only need to move it to your Applications folder.

Linux and others

Csound is available from the official package repositories for many distributions like OpenSuse, Debian, Ubuntu, Fedora, Archlinux and Gentoo. If there are no binary packages for your platform, or you need a more recent version, you can get the sources from the Github page and build from source. You will find the most recent build instructions in the Build.md file in the Csound sources or in the Github Csound Wiki.

iOS

If you would just like to run Csound on your iPad, there is an app for iOS called CsoundPad:
http://itunes.apple.com/app/csoundpad/id861008380?mt=8#

If you are a developer, Csound can be run in an iOS app that you are programming by including the Csound-for-iOS files in your Xcode project. The zip archive for these files is included in the same directory that other releases are available in, for example for version 6.05 of Csound, the files are here:
http://sourceforge.net/projects/csound/files/csound6/Csound6.05/
The "csound-iOS-6.05.0.zip" file contains an archive of an example project and PDF manual.

Some sample projects:

Android

The Android files for Csound can be found via the Csound download page on github: http://csound.github.io/download.html.

Two files are of interest here (in the Csound6 folder). One is a CSD player which executes Csound files on an Android device (the CSD player app is called Csound6.apk). This app also includes examples.

You can also install the Csound6.apk from the Google Play Store.

If you want to use Csound6 on Android, have a look at chapter 12F in this manual, which describes everything in detail.

On Google's Play Store there are some apps that use Csound. Below is a small sample of such apps:

Install Problems?

If, for any reason, you can't find the CsoundQt frontend on your system after install, or if you want to install the most recent version of CsoundQt, or if you prefer another frontend altogether: see the CSOUND FRONTENDS section of this manual for further information. If you have any install problems, consider joining the Csound Mailing List to report your issues, or write a mail to one of the maintainers (see ON THIS RELEASE).

The Csound Reference Manual

The Csound Reference Manual is an indispensable companion to Csound. It is available in various formats from the same place as the Csound installers, and it is installed with the packages for OS X and Windows. It can also be browsed online at http://csound.github.io/docs/manual/index.html. Many frontends will provide you with direct and easy access to it.

How to Execute a Simple Example

Using CsoundQt

Launch CsoundQt. Go into the CsoundQt menubar and choose: Examples->Getting started...-> Basics-> HelloWorld

You will see a very basic Csound file (.csd) with a lot of comments in green.

Click on the "RUN" icon in the CsoundQt control bar to start the realtime Csound engine. You should hear a 440 Hz sine wave.

You can also run the Csound engine in the terminal from within CsoundQt. Just click on "Run in Term". A console will pop up and Csound will be executed as an independent process. The result should be the same - the 440 Hz "beep".

Using the Terminal / Console

1. Save the following code in any plain text editor as HelloWorld.csd.

   EXAMPLE 02A01_HelloWorld.csd 

<CsoundSynthesizer>
<CsOptions>
-odac
</CsOptions>
<CsInstruments>
;Example by Alex Hofmann
instr 1
aSin      poscil    0dbfs/4, 440
          out       aSin
endin
</CsInstruments>
<CsScore>
i 1 0 1
</CsScore>
</CsoundSynthesizer>

2. Open the Terminal / Prompt / Console

3. Type: csound /full/path/HelloWorld.csd

where /full/path/HelloWorld.csd is the complete path to your file. You also execute this file by just typing csound then dragging the file into the terminal window and then hitting return.

You should hear a 440 Hz tone.

Using Cabbage

Cabbage is an alternative frontend for working with Csound. It is most similar to CsoundQt but its main differences with CsoundQt are that graphical user interface (GUI) can be created either by drawing (click and drag) or by typing code. In CsoundQt the GUI code is 'hidden' from us in the editor so that we only create GUI using the mouse. Cabbage can also export instruments and effects as VST and AU plugins, and even includes its own host, Cabbage Studio, for graphically connecting multiple instruments and effect in a manner similar to Pure Data. Cabbage is a less comprehensive frontend that CsoundQt but some users prefer this simplicity.

To get started with Cabbage you will need to first download Cabbage. Cabbage will normally come bundled with its own version of Csound and will not require a separate installation of Csound. Any currently installed versions of Csound will be ignored by Cabbage.

Once installed, launch Cabbage and then go to Options->New Cabbage...->Instrument to create a new patch (called a Cabbage patch). Cabbage will start you off with a simple functional instrument with a virtual keyboard but you can also use the one listed below which features a virtual keyboard and a volume control. To open Cabbage's integrated code editor go to Options->View Source Editor. You can then paste in the code shown below, or just make modifications to the default instrument code. If you want to make changes to what external hardware devices Cabbage uses, such as audio and MIDI hardware, go to Options->Audio Settings. The options available will vary depending on your specific system, so will not be discussed any further here.

When creating a realtime instrument, there is no necessity to include any Csound score events (or any <score> tags). With earlier versions of Csound it used to be that we needed to include a 'dummy' score event to keep realtime performance going but with more recent versions of Csound this is no longer the case.

The key element that differentiates Cabbage from standard Csound is the inclusion of Cabbage specific code, mainly used for creating a graphical user interface, held within the start and end tags: <Cabbage> and </Cabbage>. Communication from the Cabbage GUI to Csound is either transparent, as in the case of the 'keyboard' widget, or via named channels and the chnget opcode in the Csound orchestra when using most other Cabbage widgets such as 'rslider' (a rotary slider). For additional information on Cabbage please consult the chapter on Cabbage.

   EXAMPLE 02A02_HelloCabbage.csd 

<Cabbage>
form size(420,100)
keyboard bounds(10,10,300,80)
rslider bounds(325,15,80,80), channel("level"), text("Level"), range(0,1,0.3)
</Cabbage>

<CsoundSynthesizer>

<CsOptions>
-dm0 -n -+rtmidi=null -M0
</CsOptions>

<CsInstruments>

sr     = 44100
ksmps  = 32
nchnls = 2
0dbfs  = 1

instr    1
 icps cpsmidi
 klev chnget  "level"
 a1   poscil klev*0.2,icps
      outs   a1,a1
endin

</CsInstruments>

</CsoundSynthesizer>

There has been error in communication with Booktype server. Not sure right now where is the problem.

You should refresh this page.