Making music with Csound

Hardware Matters

As noted previously, Csound runs on a wide variety of platforms and processors. Virtually all modern desktop and laptop systems are fully capable of running Csound in real time, and much labor has already gone into making it work on iOS and Android systems. Csound has also found favor with DIY circuit designers, such as Arduino and BeagleBoard.

Regarding your audio hardware, Csound can handle anything from simple mono/stereo output to large multichannel, multispeaker arrays. Ambisonics sound spatialization is supported, and composer Peiman Khosravi has explored some impressive capabilities with an FFT-based panning technique. Multichannel output typically requires specialized hardware, but if you have the gear, Csound can make it sing.

Csound's audio capabilities are limited essentially only by the level of your hardware. If your audio interface is capable of recording and playing 32 channels of audio with a 96kHz sampling rate and 32-bit dynamic resolution, Csound can handle it. On the other hand, if your only sound device is a 16-bit Sound Blaster, you can still use it to its limits with Csound. Audio file I/O is defined by the wonderful libsndfile, which is therefore extensive and provides full support for multichannel formats. With the appropriate libraries, the system can also handle compressed files in MP3 and OGG formats. Incidentally, my Csound productions are always created with a sampling rate of 48kHz and a 32-bit resolution. By default, Csound is configured to output 16-bit sound files at 44.1kHz (i.e., CD quality). Much of my music has a broad dynamic range, and I prefer distributing it on DVD rather than the lower quality CD.

Terminology Alert!

Throughout this article, I'll be using jargon and technical terms from the world of digital audio. A glossary is unwieldy here, but a quick Google search shows many helpful sites with relevant technical glossaries. (I like the one at Sound On Sound [2].) If you find yourself bewildered by terminology, be sure to make use of these sites.

Installing Csound

Most mainstream distributions include Csound in their official software repositories. However, before installing, you should check the build's level of completeness. Csound can be compiled with a variety of optional features, not all of which might be included by the maintainer.

If you want or need to compile it yourself, extensive instructions are contained in the Csound manual [3]. Building Csound isn't difficult – it uses the cmake build system – but you must ensure that the necessary support libraries are installed on your machine. Missing optional items are unlikely to halt the process, but you'll end up with a version of Csound that may not suit your purposes.

The default installation for Linux places the csound binary in /usr/local/bin, the libcsound library in /usr/local/lib, and the internal plugins in /usr/local/lib/csound. A few other files are located in the /usr/local hierarchy, and that's it. By the way, if you intend to use Csound with Python or one of its other language bindings, you may need to install the required library manually to its expected location (e.g., /usr/lib/python/site-packages).

Configuration is largely automatic. A variety of environment variables can be set to indicate paths for sound and analysis files, audio samples for the STK (Perry Cook's Synthesis ToolKit [4]) opcodes, MIDI files, and so forth. To ensure that the variables are set correctly for the locale and the opcode directory, add these lines to your $HOME/.bashrc file:

export OPCODEDIR64=/usr/local/lib/csound/plugins64-6.0
export CSSTRNGS=/usr/local/share/locale

Now your basic environment is good to go.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More