nchnls

nchnls — Sets the number of channels of audio output.

Description

These statements are global value assignments, made at the beginning of an orchestra, before any instrument block is defined. Their function is to set certain reserved symbol variables that are required for performance. Once set, these reserved symbols can be used in expressions anywhere in the orchestra.

Syntax

nchnls = iarg

Initialization

nchnls = (optional) -- set number of channels of audio output to iarg. (1 = mono, 2 = stereo, 4 = quadraphonic.) The default value is 1 (mono).

In addition, any global variable can be initialized by an init-time assignment anywhere before the first instr statement. All of the above assignments are run as instrument 0 (i-pass only) at the start of real performance.

Examples

Here is an example of the nchnls opcode. It uses the file nchnls.csd.

Example 536. Example of the nchnls opcode.

See the sections Real-time Audio and Command Line Flags for more information on using command line flags.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac   -idac   ;;;realtime audio I/O
; For Non-realtime ouput leave only the line below:
; nchnls.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2				;two channels out
0dbfs  = 1

instr 1 

ain1, ainr ins				;grab your mic and sing
adel  linseg 0, p3*.5, 0.02, p3*.5, 0	;max delay time = 20ms
aoutl flanger ain1, adel, .7
aoutr flanger ain1, adel*2, .8
      fout "in_s.wav", 14, aoutl, aoutr ;write to stereo file,
      outs aoutl, aoutr			;16 bits with header

endin
</CsInstruments>
<CsScore>

i 1 0 10
e
</CsScore>
</CsoundSynthesizer>


See Also

kr, ksmps, sr