nchnls_i — Sets the number of channels of audio input.


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.


nchnls_i = iarg


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

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.


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

Example 671. Example of the nchnls_i opcode.

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

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

sr   = 44100
ksmps   = 32
nchnls   = 2	;2 channels out
0dbfs    = 1
nchnls_i = 4	;4 channels in

instr 1 ;4 channels in, two channels out

ain1, ain2, ain3, ain4 inq		;grab your mics and sing

adel   linseg 0, p3*.5, 0.02, p3*.5, 0	  ;max delay time = 20ms
adel2  linseg 0.02, p3*.5, 0, p3*.5, 0.02 ;max delay time = 20ms	
aoutl  flanger ain1, adel, .7
aoutr  flanger ain2, adel*2, .8
aoutla flanger ain3, adel2, .9
aoutra flanger ain4, adel2*2, .5
;write to quad file, 16 bits with header
       fout "in_4.wav", 14, aoutl, aoutr, aoutla, aoutra	
       outs (aoutl+aoutla)*.5, (aoutr+aoutra)*.5 ;stereo out


i 1 0 10

See also

Orchestra Header Statements