REAL-TIME AUDIO OUTPUT HINTS FOR WINDOWS VERSIONS OF CSOUND Art Hunkins - May 2005 For the Windows platform, the most responsive, versatile and user-friendly of real-time Csounds is CsoundAV. Performers and relative newcomers to Csound will experience fewer problems with CsoundAV compared to other versions. (This is why CsoundAV is the preferred version for my real-time compositions.) For extensive discussion of CsoundAV, as well as a general orientation to real-time performance issues of Windows Csound, see my article, "Real-Time Audio Output Hints for CsoundAV." CsoundGBS/flCsound-- CsoundGBS/flCsound Windows executables are located at: http://sourceforge.net/project/showfiles.php?group_id=81968 The GBS version, currently GBS13, is command-line, while flCsound incorporates a simple GUI. FlCsound is the more user-friendly for beginners. With these versions, you need the following set of command-line flags or CsOptions: For files not using MIDI: -m0d -odac For files using MIDI: -M0 -m0d -odac The -m0d (composite) flag gets rid of messages and displays that can cause clicks in real-time audio. You can modify CsOptions with any text editor, such as Notepad. (CsOptions are toward the beginning of a .csd file.) These examples of flags assume that you have a single audio output device (and MIDI input device). Device numbers always start with zero. If you need to specify a different device number, identify the appropriate number by examining your message output (where they are all listed), and add it to your flags (e.g., -odac1, -M1). These versions are limited to stereo (MME drivers only). Victor Lazzarini's MyCsound4-- MyCsound4 is a command-line only version found at: http://www.nuim.ie/academic/music/musictec/csound Use the same set of command-line flags or CsOptions as given for the GBS/ flCsound versions above. This version too is limited to stereo (MME only). In either of these alternative Csounds, sonic output may be broken and sporadic. The drivers they use are the older, higher latency (delayed response) MME variety. *Adding a -b1000 flag to the command line or CsOptions will likely help this*. You are urged to experiment with values of -b from 1000 to 4000 to find the number that gives you the most click-free and immediate audio response. (Lower values will give faster response, but risk clicks and pops.) Also, closing as many concurrently running processes in the background as possible will help avoid breakup. Note that the -B flag is not used in either of these versions. Csound5beta-- A new, command-line, *beta* version of canonical Csound: http://sourceforge.net/project/showfiles.php?group_id=81968 Csound5 is the future of Csound, and is intended to be a (much needed) cross-platform solution. Though it is presently considered beta software, Csound5 for Windows is ready for real-time use. It requires ASIO drivers, and will not work with MME or DirectSound; however, with the advent of ASIO4ALL, this is no longer a problem (see below). The only real-time limitation of ASIO currently is that it cannot do audio input and output (full-duplex) at the same time. (Contrast this to CsoundAV, which is capable of doing full-duplex ASIO - as well as MME and DirectSound.) Csound5beta and CsoundAV are the two Windows Csounds capable of *multichannel* output. Here is list of items to observe with Csound5beta: 1) The author of ASIO4ALL (an ASIO driver for *stereo* soundcards) has recently done a version that supports SR's below 44100 (down to and including 8000) - whatever your sound card allows. What this means is that real-time pieces that "broke up" on slower computers can now be performed with unbroken sound at slower SR's for at least test/compositional purposes. Here is the link to this latest version (ASIO4ALL 2.6): http://www.asio4all.com/A4Av2Ins.exe *Without* ASIO4ALL, stereo soundcards cannot run Csound5beta. *Native* ASIO drivers are only available for multi-channel cards. 2) Istvan Varga's Linux recommendations relative to -B and -b flags for Linux (command-line or CsOptions) also work well for Windows. *Both -B and -b must be specified* for realtime. -B is the more critical value. The recommended flags: For files not using MIDI: -m0d -odac -B256 -b64 For files using MIDI: -M0 -m0d -odac -B256 -b64 These values will work in nearly all cases. The only exception is SR (sample rate) = 44100 and above on slower computers, where -B must be raised to 2048. Note that -B should always be larger than, and a multiple of -b. (This is not required, but works well.) Both numbers need to be integers, and are preferably powers of 2 (2, 4, 8, 16, 32, 64 etc.) -B is the more significant value. Note that if you have *more than one ASIO driver* installed (including ASIO4ALL), you may need to add a device number following -odac (-odac defaults to -odac0). The *multichannel* driver seems to install itself as #0; ASIO4ALL follows as -odac1. So, in such cases, -odac (no device number) is probably safe for the multichannel device, while -odac1 is likely required for ASIO4ALL. When in doubt, look at the runtime messages to see how the output devices are numbered. In general with Csound: Faster computers will permit smaller -B (and -b) buffer values - thus lower latency, while slower computers require higher values (resulting in higher latency). Also, the lower the SR, the lower the buffer values can be (lower latency). Conversely, the higher the SR, the higher these values may need to be (thus resulting in greater latency). The above observations apply equally to native ASIO drivers as well as ASIO4ALL. When using ASIO4ALL, I recommend the following setup in its Off-Line Settings (linked on the Desktop): 1) Disable selected sound card's audio inputs. 2) Set ASIO Buffer Size to maximum (2048). 3) Set Kernal Buffers to maximum (4). 4) Turn off "Always Resample 44.1 kHz." These steps will eliminate/minimize broken sound.