guide to install Csound5 on Ubuntu 10.04 and Ubuntu 11.10

These are the steps i take for installing the most recent Csound install from GIT (using command: git clone git://csound.git.sourceforge.net/gitroot/csound/csound5) in (K)(X)Ubuntu. The GIT version of Csound still may contain some bugs but i just want to have the most recent version of Csound on my system. After downloading the source package from GIT, these are the steps to take to build the latest version of Csound.

What packages are needed?

  • install scons
  • install libsndfile AND libsnd-dev. The manual says libdsndfile but look for libsndfile
  • i have python2.6 and -dev installed, for Ubuntu 11.10 python2.7 and -dev
  • portaudio19 and portaudio19-dev
  • portmidi and portmidi-dev. For Suse i did not see Portmidi, i'm depending on Alsa midi for that
  • alsa-source
  • libpng12-dev
  • FLTK1.1 and FLTK1.1.dev
  • libfftw3-dev (for Loris)
  • swig
  • libfluidsynth1 and libfluidsynth-devitem
  • liblo0-dev for completeness-sake (i do not need OSC atm)
  • libasound2-dev
  • DSSI and DSSI-dev
  • flex and bison for building with the new parser
  • libboost1.40-dev and libgmm++-dev for installation of Chuap, CsoundAC and the Linear Algebra Opcodes

These packages are now on the system, but for some extras every time you are rebuilding the latest version, you can take the following steps:

The extra goodies

- if you want the STK opcodes included:

- MP3 support:

  • Download mpadec (version beta) http://mpadec.cvs.sourceforge.net/viewvc/mpadec/ (cvs -z3 -d:pserver:anonymous@mpadec.cvs.sourceforge.net:/cvsroot/mpadec co -P mpadec)
  • "make" to compile and do a MANUAL install: sudo cp ./include/mp3dec.h ./include/mpadec.h /usr/include AND sudo cp ./libmpadec/libmpadec.a ./libmpadec/libmpadec.so /usr/lib

- if you want Loris opcodes:

  • go to http://sourceforge.net/projects/loris/files/ and get Loris version 1.8.
  • install Loris with this option: sh ./configure "CPPFLAGS=-I/usr/local/include/csound -DUSE_DOUBLE" It will create the Csound Loris opcodes (along with Loris itself), here for double precision.
  • When you run Csound use an additional command line flag: --opcode-lib=/usr/local/lib/libloris.so

Another method described by Tito Latini:

  • remove the old plugin
  • install Loris as mentioned above but without csound
  • copy or link these directories from loris-1.8 source dir to Opcodes/Loris in the Csound5 directory: csound, src, scripting
  • recompile csound (buildLoris=1)

For more information on the installation of Loris 1.8 have a look at: http://www.csounds.com/node/1380

- there are "unofficial" opcode files that did not make it to the standard Csound (yet). They can be downloaded from http://noisesmith-linux-audio.googlecode.com/svn-history/r114/trunk/csou... .
These opcodes are produced:

  • linuxjoystick
  • imageblit, imagecreate, imagegain and imagediv.

The files imagemanip.c and imagemanip.h along with linuxjoystick.c and linuxjoystick.h must be copied to the Opcodes folder of Csound before building. Also add these two line in the SConstruct file of Csound, for example as line 1600:

  • makePlugin(pluginEnvironment, 'linuxjoystick', ['Opcodes/linuxjoystick.c'])
  • makePlugin(pluginEnvironment, 'imagemanip', ['Opcodes/imagemanip.c'])

A modified linuxjoystick opcode can be downloaded here: http://members.home.nl/mag.knevel/joystick_opcode. The examples are a bit modified too.

- custom-linux-jpff.py is the script i use to handle nonstandard options for third-party dependencies, so rename custom-linux-jpff.py -> custom.py

- optional: I am a blue user (http://sourceforge.net/projects/bluemusic/), a great compositional program for Csound, but to take full advantage of the API i had to build Csound with the scons option buildJavaWrapper=1

  • if you prefer java-sun: change something in the SConstruct file (line 799). It was looking for an older Java file, while i have 1.6.0.26.
    The line should be: for i in ['java', 'jvm/java', 'jvm/java-6-sun-1.6.0.26']:
  • OR, if you use OpenJDK you can change the line 24 in the file custom.py (previously custom-linux-jpff.py) to: customCPPPATH.append('/usr/lib/jvm/java-6-openjdk/include')
    Probably you will need to install openjdk-6-jdk (=dev) too.

Installing Csound

I want to install the Double Precision Version, so i am running scons in the csound5 directory with useDouble=1 and other options:
scons -j 3 buildDSSI=1 buildImageOpcodes=1 buildInterfaces=1 buildJavaWrapper=1 buildNewParser=1 buildPythonOpcodes=1 buildUtilities=1 buildVirtual=1 Lib64=0 useDouble=1 usePortAudio=1 usePortMidi=1 useALSA=1 useJack=1 useFLTK=1 Word64=1 buildPythonWrapper=1 smoothSort=1 includeMP3=1 buildCsoundAC=1 buildStkOpcodes=1 buildBeats=1 dynamicCsoundLibrary=1 buildOSC=1 useOSC=1 >compile.txt
A text file will be written to the csound5 directory so you can see later on what was build and how exactly.

It builds Csound in its directory.
Then:
sudo python install.py
and it installs.

Epilogue...

Then setting the environment. The file /etc/environment has to be edited:

  • OPCODEDIR64="/usr/local/lib/csound/plugins64"
  • CSSTRNGS="/usr/local/share/locale"
  • RAWWAVE_PATH=/usr/local/share/csound/rawwaves

and why not while we are there, the home settings for SADIR, SFDIR, SSDIR:

  • SFDIR="/home/user/csound/Output"
  • SSDIR="/home/user/csound/Samples"
  • SADIR="/home/user/csound/Analyses"

Csound can be uninstalled by running /usr/local/bin/uninstall-csound5

happy csounding,
Menno Knevel

Thanks! My experience ...

I just installed CSound from source on 64-bit stock Ubuntu Lucid (not Ubuntu Studio), and your instructions made it much easier.

A couple of points:

I recommend copying the mpadec files to /usr/local/include and /usr/local/lib, because that's typically how Ubuntu (or Debian) helps you keep track of what's package-installed and what you've installed yourself. Packages never install in /usr/local, so if you put your self-installed files there, life will be easier.

To see what options are available to pass to scons, use "scons -h". This produces a long list so it's best to redirect it to a file like "scons -h > options.log" then go through options.log deciding whether you want each option. You can make a simple shell script to run scons with the options you pick as you read through it.

If you have a dual-core machine, you can practically double your compilation speed by adding "-j 3" as a switch to scons. This is the number of processes scons will try to run at once. The default is 1 which only keeps one core busy.

Here's the script I ended up using to build CSound:

#!/bin/bash
scons -j 3 \
useDouble=1 \
buildCsoundAC=1 \
buildCsound5GUI=1 \
buildLoris=1 \
useOSC=1 \
buildPythonOpcodes=1 \
Word64=1 \
buildStkOpcodes=1 \
buildVirtual=1 \
buildInterfaces=1 \
buildLuaWrapper=1 \
buildPythonWrapper=1 \
buildJavaWrapper=1 \
buildCSEditor=1 \
buildNewParser=1 \
includeMP3=1

One more thing: If you want SFDIR and friends to point somewhere under your home directory, there is a better way to set that up. If you're the only user of your machine it probably doesn't matter, but if there are other users, defining those environment variables in /etc/environment will cause them to try to write into your home directory, and probably (hopefully!) have a permissions problem doing so.

For every user to have these environment variables point to the same structure under their own home directory, you can create a file in /etc/profile.d (I called mine csound-env.sh) with this contents:

export SADIR=$HOME/csound/Analyses
export SFDIR=$HOME/csound/Output
export SSDIR=$HOME/csound/Samples

Alternatively, this could be the kind of thing each user wants to decide for themselves. In that case you would just put these lines at the end of the .bashrc file in your home directory, which will only set them for you.

Thanks again, Menno. Your hard work saved me a lot of trouble.