Using

Assuming that you have installed and configured the software, Csound and CsoundVST can be operated in a variety of modes and configurations. The .csd and .py files in the examples directory demonstrate a few of these modes of operation. Some of these scores are simple, others are moderately complex.

You may need to edit the SoundFont file paths in instrument definitions that use the fluid SoundFont 2 player opcode to match your environment.

Real-Time Audio

For real-time audio output, with or without MIDI control, you will probably want to tune the kr and ksmps orchestra statements, and the -b and -B command-line options, to give you the shortest possible latency that does not cause clicks or stutters in Csound's audio output.

In general, -b (Csound's audio buffer) should be set to a small power of 2 (such as 64 or 128), and -B (the audio driver's buffer) should be set to 2 or 4 times that.

Currently, with -B set to 512, audio output latency is about 12 milliseconds, fast enough for reasonably responsive keyboad playing.

Even shorter latencies, as low as 3 milliseconds on some systems, are feasible.

Windows with ASIO

If your sound card does not have an ASIO driver, you can still use Csound with ASIO by downloading and installing the asio4all adapter from http://www.asio4all.com.

Using Csound5 with JACK

Command line options

To enable the JACK plugin, use this command line option:

  -+rtaudio=jack

Additionally, there are some command line options specific to JACK:

JACK Command-line Flags

-+jack_client=[client_name]

The client name used by Csound, defaults to 'csound5'.

-+jack_inportname=[input port name prefix], -+jack_outportname=[output port name prefix]

Name prefix of Csound JACK input/output ports; the default is 'input' and 'output'. The actual port name is the channel number appended to the name prefix. Example: with the above default settings, a stereo orchestra will create these ports in full duplex operation:

      csound5:input1              (record left)
      csound5:input2              (record right)
      csound5:output1             (playback left)
      csound5:output2             (playback right)
      

-+jack_sleep_time=[sleep time in microseconds]

Amount of time to wait before checking the buffer state again if it is full (playback) or empty (record). A higher value means worse latency and timing, but lower CPU usage. The default is 1000.

Connecting Csound to other JACK clients

By default, no connections are made (you need to use jack_connect); however, the plugin can connect to ports specified as '-iadc:portname_prefix' or '-odac:portname_prefix' portname_prefix is the full name of a port without a channel number, such as 'alsa_pcm:capture_' (for -i adc), or 'alsa_pcm:playback_' (for -o dac).

Notes on buffer sizes

The -b option sets the period time in samples, and should be set to the same value as the buffer size of JACK. -B is the total length of the ring buffer. Both options must be power of two, and -b must be less than -B.

If -iadc is used, ksmps should be set to an integer power of two, and should be less than or equal to -b.

An example of buffer settings for low latency on a fast system:

  jackd -d alsa -P -r 48000 -p 64 -n 4 &
  csound -+rtaudio=jack -b 64 -B 256 [...]

with real time scheduling (as root):

  jackd -R -d alsa -P -r 48000 -p 64 -n 4 &
  csound --sched -+rtaudio=jack -b 64 -B 256 [...]

Note that the -p option for jackd is the same as -b for Csound. To improve performance, use ksmps values like 32 and 64.

The sample rate of the orchestra must be the same as that of the JACK server.