Environmental Variables
After compiling csound 5.06.0 on Ubuntu 7.0.4 I ran into the following informative message when running csound from the command line:
$ csound -odac -iadc test.orc test.sco
...
WARNING: OPCODEDIR IS NOT SET
Csound requires this environment variable to be set to find its plugin libraries.
If it is not set, you may experience missing opcodes, audio/MIDI drivers, or utilities.
Ubuntu handles environmental variables differently than other Linux distros. The variables won’t stick if you place them in places like:
- /etc/profile
- /etc/bash.bashrc
- ~/.bashrc
OPCODEDIR=/usr/local/lib/csound/plugins
You may also need to set this in /etc/environment depending on your setup:
OPCODEDIR64=/usr/local/lib/csound/plugins
In my case logging out and back in was also necessary.
Real Time Playback Problems with PortAudio
The next issue was that realtime output was not playing:$ csound -odac -iadc test.orc test.sco
...
*** error: unknown rtaudio module: 'PortAudio'
Failed to initialise real time audio input
Csound can use various real time (“rtaudio”) modules. Typically these are PortAudio and ALSA. For whatever reason PortAudio was installed but not available to csound. To use ALSA as the rtaudio module I used this command:
csound -odac -iadc -+rtaudio=alsa test.orc test.sco
Success!
Bonus
Since I am lazy (or pragmatic) and don’t like typing. I stored the flags above in ~/.csoundrc-odac -iadc -+rtaudio=alsa
Now Csound can be run with these flags using:
csound test.orc test.sco