chnrecv

chnrecv — Recieves data from the software bus.

Description

Receives data from a channel of the inward named software bus. Implies declaring the channel with imode=1 (see also chn_k, chn_a, and chn_S). Note that chnsend/chnrecv (which in Csound6 work identically to invalue/outvalue) are usually used for the callback-based communication between Csound and an external host. Use the chnset/chnget opcodes for sending and receiving data inside Csound.

Syntax

ival chnrecv Sname
kval chnrecv Sname
aval chnrecv Sname
Sval chnrecv Sname

Initialization

Sname -- a string that identifies a channel of the named software bus to read.

Performance

ival -- the control value read at i-time.

kval -- the control value read at performance time.

aval -- the audio signal read at performance time.

Sval -- the string value read at i-time.

[Note] Note

Example

The example shows the software bus being used as an asynchronous control signal to select a filter cutoff. It assumes that an external program that has access to the API is feeding the values.

        sr = 44100
        ksmps = 100
        nchnls = 1

        instr   1
           kc   chnrecv    "cutoff"
           a1   oscil     p4, p5, 100
           a2   lowpass2  a1, kc, 200
                out       a2
        endin

Credits

Author: Istvan Varga
2005