playitbyr Getting Started Support--Help, Bugs, and Documentation GitHub Sonification Resources

Setting up Csound

playitbyr and the csound package require Csound, a free and open source software synthesizer. Hopefully, you can just install Csound and the csound will automatically detect it and be able to use it; but here are some tips if you run into trouble.

These instructions assume you have already installed csound, which you can install from CRAN by typing

install.packages("csound")

Getting Csound

Csound can be retrieved from its Sourceforge site, but the download links are a bit outdated and confusing. Here are direct links to a recent version of Csound (5.17-6) for different platforms:

Debian Linux

OpenSUSE Linux

Mac OS X (10.6)

Mac OS X (10.7)

Windows

Windows and Mac OS X versions both have easy-to-use installation instructions; make sure any options for "Libraries" are enabled during the installation, since csound links to the shared library file.

It is also available from the Debian and Ubuntu reposotories, available via the command:

sudo apt-get install libcsound64-dev

Back to top

Linking to Csound in R

Now that Csound's installed, we can see if R is able to see it:

library(csound)

If this doesn't give you any messages or warnings, you should be all set. However, you may recieve a warning that looks like this:

Note: No valid csound library found automatically. You must have a valid Csound library to use this package; if you know the path to your Csound shared library, you can specify it using setCsoundLibrary.

Where do you find this mysterious 'library'? This is the file that R calls to use the sound functionality of Csound. It probably has the extension .so on Linux, .dylib on Mac OS X, and .dll on Windows and has a name like libcsnd, and it is lurking somewhere on your computer. It may have a version number (some numbers and dots, like '5.2', tacked on after the extension.

As a rule of thumb, if you see two libraries and one of them has a '64' in it, that one will work better with the csound package. Here's some hunting tips:

On Linux, see if you can find it somewhere in /usr/local/lib/ or /usr/lib/. (Usually it can find it automatically on Linux.)

On Windows, look at \Program Files\Csound\bin\ or somewhere around there.

On Mac OS X, I found it in /Library/Frameworks/CsoundLib64.framework/Versions/Current/. (It seems to have the most trouble finding it on OS X.)

Once you've found the library file, you can make tell the csound package about it:

setCsoundLibrary("path/to/library/file")

Back to top

A quick sound test

If the csound package is loaded, you can run the following commands as a sound test. If you hear a series of tones and fuzz, you're in business.

example(createPerformance)
createPerformance(sndcheck)

Back to top