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
(incl. VAT)
Buy Linux Magazine
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.
News
-
TUXEDO Computers Unveils Linux Laptop Featuring AMD Ryzen CPU
This latest release is the first laptop to include the new CPU from Ryzen and Linux preinstalled.
-
XZ Gets the All-Clear
The back door xz vulnerability has been officially reverted for Fedora 40 and versions 38 and 39 were never affected.
-
Canonical Collaborates with Qualcomm on New Venture
This new joint effort is geared toward bringing Ubuntu and Ubuntu Core to Qualcomm-powered devices.
-
Kodi 21.0 Open-Source Entertainment Hub Released
After a year of development, the award-winning Kodi cross-platform, media center software is now available with many new additions and improvements.
-
Linux Usage Increases in Two Key Areas
If market share is your thing, you'll be happy to know that Linux is on the rise in two areas that, if they keep climbing, could have serious meaning for Linux's future.
-
Vulnerability Discovered in xz Libraries
An urgent alert for Fedora 40 has been posted and users should pay attention.
-
Canonical Bumps LTS Support to 12 years
If you're worried that your Ubuntu LTS release won't be supported long enough to last, Canonical has a surprise for you in the form of 12 years of security coverage.
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.