Making music with Csound

Sound Design

© Lead Image © David Sandonato,

© Lead Image © David Sandonato,

Article from Issue 158/2014

The powerful Csound software provides an impressive set of features for audio production and processing. We walk you through the entire system.

Csound is a software system designed for digital audio synthesis, signal processing, and music composition. As a production environment, Csound [1] is fully mature, with a well-tended development track extending from the 1970s to the present day. Csound runs on all major platforms, including iOS and Android systems, with support for a broad range of hardware. Csound is free software as defined by the FSF and is licensed under the LGPL.

The System

Csound's system is an organization of agreeable parts. The Csound binary, which is typically found at /usr/bin/csound or /usr/local/bin/csound, is the engine that processes your code and sends the output on its way, either as a sound file or as real-time sound. Csound's native user interface is a domain-specific programming language with built-in elements for audio production and processing. These elements, called opcodes, are the fundamental building blocks for all your Csound designs. The system further includes a language for scoring a composition, a multifarious set of utilities, and a variety of interface extensions that ally Csound's powers with the general capabilities of C/C++, Java, and Python.

Incidentally, the C in Csound refers to the language of the internal code. No prior knowledge of C or any other programming language is required to use Csound effectively, however, and with one of its excellent front ends, you may find that you have no need at all to program directly in native Csound.

What Can It Do ?

A proprietary synthesizer is usually built around a specific synthesis method. Thus, Yamaha's DX line of synthesizers were built on principles of FM synthesis, whereas Roland's Juno and Jupiter synths are based on classic subtractive synthesis methods, and Modartt's Pianoteq instruments are constructed by physical modeling synthesis. Csound imposes no such specific restriction. You can freely mix additive, FM, subtractive, granular, physical modeling, and other synthesis technologies, allowing you to design synthesizers with greater complexity than any hardware on the market. For example, you can build banks of identical or varied filters and effects, specify parameter envelopes with any number of breakpoints, and project your sounds in spatialization formats from simple stereo to multichannel speaker arrays.

Those "other" technologies referred to above include some recently developed methods, such as scanned synthesis (an offshoot of physical modeling), hyper-vectorial synthesis (a method for smooth cross-fading between waveforms), and wave terrain synthesis (which determines a waveform by scanning a 3D surface) and are all new worlds to me  – areas of sound production waiting for further exploration.

Csound can function as a powerful sampler/rompler. Real-time audio and sound file I/O is supported by various opcodes, including some that allow permutation of pitch and time. Looping opcodes are available, again with pitch and time shifting. SoundFont playback is handled by a set of opcodes based on FluidSynth, a well-known, open source playback engine for sounds in the SoundFont SF2 format.

Csound's DSP capabilities are impressive. Opcodes are available for various reverb types, delay lines, chorusing units, flangers, and other commonly encountered effects. For those who like to have greater control, various filter types can be employed for designing your own equalizers, delay lines, and reverb units. Of course, a full complement of opcodes can be invoked for mixing, balancing, gating, compressing, and limiting the signals in your mix.

Personally, I find it odd that someone might want to use plugins with Csound, but why not? Linux users can employ their favorite LADSPA signal processing plugins through the dssi4cs opcodes. Alas, DSSI plugins aren't supported yet, but it is on the to-do list. I hope to see it develop; I can imagine great possibilities with the amSynth and Hexter DSSI synthesizers wired into Csound's awesome capabilities.

Csound also supplies a set of utility programs designed for audio analysis, the results of which can be processed by associated resynthesis opcodes. For example, a file created by the hetro utility can be processed by adsyn, its target opcode. The hetro analysis separates the original sound's frequency and temporal characteristics, thus permitting independent control of pitch and duration when resynthesized by the adsyn opcode. Similar arrangements exist for the phase vocoder, LPC, ATSA, and convolution analysis utilities. Each is associated with an opcode or set of opcodes designed to process the utility's output file format. Time-stretching, pitch-shifting, and reverberation are some common applications of these tools.

The Test Bench

I'll look at Csound version 6.00, built and installed on a dual-core machine running Ubuntu 12.04 in 32-bit mode. My 64-bit box is currently under reconstruction, but I can testify that Csound runs perfectly well on 64-bit Debian and Arch systems. My Ubuntu boxes are always customized with KXStudio, an overlay that provides an audio-optimized system and a complete set of tools for getting right to work with music and sound on Linux.

Csound can be installed from the normal Ubuntu repos, but I've been rolling my own for so long I can't stop now. I compile Csound with activated options for OSC support, the Java and Python language interfaces, integrated FLTK graphics, and a few other personal preferences. However, the examples I'll present here require only a plain vanilla Csound.

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