Special Command Line Flags

FLAG 

ARGUM

DESCRIPTION 

-+P

<num> Portaudio  output device (including ASIO, MME and DirectSound devices)
<num> is optional, if you omit it, a list of all the available Portaudio devices will be displayed, then you can choose one of them by typing the corresponding number to the console. Currently CsoundAV supports 16-bit integers and 32-bit floats (with the -f flag).  Never use it together with -+S, -+X, -+C, -+p, -+q -i, -+* or -b flags.

-+I

<num> (uppercase 'i') Portaudio  input device (including ASIO, MME and DirectSound devices)
<num> is optional, if you omit it, a list of all the available Portaudio devices will be displayed, then you can choose one of them by typing the corresponding number to the console. Never use it together with -+S, -+X, -+C, -+p, -+q,  -i, -+* or -b flags.

-+i

<num> (lowercase 'i')  number of input audio channels with Portaudio ASIO (if this number is different from that of the output channels)
<num> required, indicates the number of input channels to be activated. Such number must be less or equal to nchnls. When the number of input channels is equal to nchnls this flag is redundant. It is useable only together with -+P or -+I flags.

This flag is mainly provided to enable native ASIO drivers in audio interfaces having a number of input channles less than the number of output channels.

-+k

<num> (lowercase 'k') Number of Portaudio buffers.
In portaudio buffer length is automatically set equal to ksmps. If this buffer length is not sufficient, you can increase number of buffers by simply using this flag with a number greater than 1 (that is the default). Never use it together with -+S, -+X, -+C  or -+q flags.

-+S 

<num> Enable DirectSound secondary buffer writing. 
<num> is optional, if you omit it, a list of available DirectX audio devices will be displayed, then you can choose one of them by typing the corresponding number to the console. Don't use this flag  together with -+p and -+q, -+X flag or -+P flag. Also, don't use the standard flag -odevaudio with this flag. When using '-o <FILENAME>' together with '-+S' flag, both realtime audio and FILE output are enabled in parallel. 
IMPORTANT
! Notice that some audio card (such as old SoundBlasters) automatically convert sound to 8-bit when using secondary buffers, so audio quality can be ugly. Also latency delay can be very high. Use primary buffer in these cases.

-+X 

<num> Enable DirectSound primary buffer writing for low-latency audio output. 
<num> is optional, if you omit it, a list of available DirectX audio devices will be displayed, then you can choose one of them by typing the corresponding number to the console. Don't use this flag  together with -+p and -+q flags (which enable old MME WAVE OUT) -+S flag or -+P flag. Also, don't use the standard flag -odevaudio with this flag. When using '-o <FILENAME>' together with '-+X' flag, both realtime audio and FILE output are enabled in parallel. 

-+K 

<num>

Enable MIDI IN.

<num> = MIDI IN device id number.
<num> is optional, if you omit it, a list of available MIDI IN devices will be displayed, then you can choose one of them by typing the corresponding number to the console. If this flag is used, don't use the standard flag -Msbmidi.

-+C 

<num> Enable DirectSoundCapture routines for low-latency audio input. 
<num> is optional, if you omit it, a list of available DirectSoundCaputure audio devices will be displayed, then you can choose one of them by typing the corresponding number to the console. Don't use this flag  together with -i flag (which enable old MME WAVE OUT). Also, don't use the standard flag -iadc with this flag.

-+q 

<num>

Enable MME WAVE OUT.

<num> = WAVE OUT device id number.

<num> is optional, if you omit it, a list of available MME WAVE OUTdevices will be displayed, then you can choose one of them by typing the corresponding number to the console. This flag enables the old MME WAVE OUT. Don't use this flag together with -+X (DirectX audio). If this flag is used, don't use the standard flag -odevaudio. When using '-o<FILENAME>' together with '-+q' flag, both realtime audio and FILE output are enabled in parallel.

-+p 

<num>

Set the number of buffers in MME WAVE OUT.

<num> is optional. default=4, maximum=40.

The number of buffers, togheter with the buffer length (flag -b<num>), must be choosen accurately, considering that, when increasing the buffer, the latency delay increases too, whereas when decreasing the buffer, the risk of pop and click due to buffer underruns increases.

-+O 

 

(uppercase letter) Suppress all printf for better realtime performance.

Using this flag is better than using '-m0' because '-m0' still leaves some message output to the console. I suggest to use both -+O and -m0 at the same time for the best realtime performance. Warning! Use '-+O' only when your orc/sco files are fully tested, because the error messages are suppressed too.

-+e 

 

Allow any output sample rate (for cards that support this feature).

When you use a non-standard sr in realtime (for example 40000), a message will inform you that this sampling frequency is not allowed by the card. Some cards can handle all the sr frequency (for example the Sound Blaster cards) within a range continuously (for example from 8000 to 44100). So you can use these frequencies without any problem by setting this flag.

-+y 

 

Don't wait for keypress on exit.

Useful for batch processing.

-+Q 

<num>

Enable MIDI OUT.

<num> = MIDI OUT device id number. <num> is optional, if you omit it, a list of available MIDI OUT devices will be displayed, then you can choose one of them by typing the corresponding number to the console.

-+Y 

 

Disable WAVE OUT (for better MIDI OUT timing performances).

When using MIDI OUT oriented orc/sco pairs, disabling WAVE OUT will improve the timing of MIDI OUT flow.

-+* 

 

Yields control to system until DAC buffer is half-empty, for better multitasking.

In some cases this flag enhanches the realtime performance, and, above all, allow to use other graphic programs concurrently with Csound in realtime, without interruptions of the sound flow. This flag will slow all other application, because set Csound process to a higher priority. It can be used both with MME (-+q) and DirectX (-+X) drivers. It doesn't work with Portaudio, so NEVER use it with -+P and/or -+I flags.

-+M

Start DirectCsoundWin with the main window minimized.

-+/ 

<filename>

Csound command line is intended to be included in a text file.

The command file must contain the flag as well as the other arguments in the same syntax of csound command line. Carriage returns inside the command file are ignored.


Examples of command-line calls of CsoundAV

The following command-line invokes a unified file session. (flags details are set internally to the .csd file).

csound.exe   test.csd

The following command-line invokes realtime MIDI performance of Csound with the DirectSound routines. The console messages are suppressed (-+O and -m0 flags), it is asked to the user the midi input port number to be used (-K flag) and the DirectSound device number (-X flags). The buffer length is set to 100 samples. 

csound.exe -+O -m0 -+X -+K -b200 miditest.orc miditest.sco

Same as the above, but with -+* flag to enhance realtime DirectX audio multitasking (in some cases this flag can make realtime performance worse. Experiment!). 

csound.exe -+O -m0 -+X -+K -b100 -+* miditest.orc miditest.sco

The following command-line invokes realtime midi performance of Csound with pedal treshold of 99, 12 wave out buffers of 882 bytes each, and prompts the user to input the MIDI IN and MME WAVE OUT device numbers. An audible delay is present, due to  the latency of the MME driver: 

csound.exe -P99 -+p12 -b882 -+K -+q miditest.orc miditest.sco

same as above but with all displays suppressed ("-O" and "-m0" flags. Use this feature only when your orc and sco are fully tested!): 

csound.exe -+O -m0 -P99 -+p12 -b882 -+K -+q miditest.orc miditest.sco

some as above but with '-+*' flag to enhance Windows multitasking: 

csound.exe -+* -+K -+q0 -P99 -+p12 -b882 miditest.orc miditest.sco

allows arbitrary sample rate (e.g.other than 1025/22050/44100) with '-e' flag and MME WAVE OUT (Note the reduced -+p and -b values when using "rounded" sr and kr values; these values are good with my Pentium133 with a sr=40000 and kr=400): 

csound.exe -+e -+O -m0 -P99 -+p4 -b100 -q -K miditest.orc miditest.sco

allows MIDI OUT operations with device num.5 (flag '-Q') in parallel with WAVE OUT: 

csound.exe -+e -P99 -+j2000 -+Q5 -+q -+p4 -+K4 -b100 midiout.orc midiout.sco

allows MIDI OUT operations with device num.5 (flag '-Q') and suppresses WAVE OUT for better MIDI OUT timing (flag '-Y'): 

csound.exe -+e -+Y -P99 -+j2000 -+Q5 -+q -+K4 midiout.orc midiout.sco

calls csound by command line contained in file 'cl.txt': 

csound.exe -+/cl.txt

enables realtime WAVE IN operation (flag '-i'without arguments) in parallel with WAVE OUT (flag '-+q') and asks to the user the number of Multimedia-Windows devices: 

csound.exe -+p12 -b882 -+q -i