outch

outch — Writes multi-channel audio data, with user-controllable channels, to an external device or stream.

Description

Writes multi-channel audio data, with user-controllable channels, to an external device or stream.

Syntax

outch kchan1, asig1 [, kchan2] [, asig2] [...]

Performance

outch outputs asig1 on the channel determined by kchan1, asig2 on the channel determined by kchan2, etc.

[Note] Note

The highest number for kchanX available for use with outch depends on nchnls. If kchanX is greater than nchnls, asigX will be silent. Note that outch will give a warning but not an error in this case.

Examples

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

Example 703. Example of the outch 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    ;;;realtime audio out
; For Non-realtime ouput leave only the line below:
; -o outch.wav -W ;;; for file output any platform

; By  Stefano Cucchi - 2020

</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1

asig vco2 0.2, 100  ; Audio signal.   	
kout randomh 1, 2, 5  ; Extracts random number between 1 & 2 - 5 times per second.

    outch kout,asig ; Sends the signal to the channel according to "kout".

printks "signal is sent to channel %d\\n", .2, kout ; Prints the channel where you hear the sound.
endin

</CsInstruments>
<CsScore>

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


Here is another example of the outch opcode. It uses the file outch-2.csd.

Example 704. Example of the outch 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    ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o outch.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 5
0dbfs  = 1

instr 1

asig vco2 .05, 100	; sawtooth waveform at low volume

kcut line 100, p3, 30	; Vary cutoff frequency
kresonance = .7
inumlayer = 3
asig lowresx asig, kcut, kresonance, inumlayer

klfo lfo 4, .5, 4	
klfo = klfo+1		; offset of 1
printks "signal is sent to channel %d\\n", .1, klfo
      outch klfo,asig

endin
</CsInstruments>
<CsScore>

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


signal is sent to channel 5
signal is sent to channel 4
signal is sent to channel 3
signal is sent to channel 2
signal is sent to channel 1
signal is sent to channel 5
........
      

Here is another example of the outch opcode. It uses the file outch-3.csd.

Example 705. Another example of the outch opcode.

<CsoundSynthesizer>
<CsOptions>
; Select audio/midi flags here according to platform
-odac      ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
; -o outch-2.wav -W ;;; for file output any platform
</CsOptions>
<CsInstruments>

sr = 44100
ksmps = 32
nchnls = 4
0dbfs  = 1

seed     0

instr 1 ;random movements between 4 speakers with outch

ichn1     random    1, 4.999 ;channel to start
ichn2     random    1, 4.999 ;channel to end
          prints    "Moving from speaker %d to speaker %d%n", int(ichn1), int(ichn2)
asamp     soundin   "fox.wav"
kmov      linseg    0, p3, 1
a1, a2    pan2      asamp, kmov
          outch     int(ichn1), a1, int(ichn2), a2
endin

</CsInstruments>
<CsScore>
r 5
i 1 0 3
e
</CsScore>
</CsoundSynthesizer>


See also

Signal Output

More information on this opcode: http://www.csoundjournal.com/issue16/audiorouting.html , written by Andreas Russo

Credits

Author: John ffitch
University of Bath/Codemist Ltd.
Bath, UK
May 2000

New in Csound Version 4.07