chngetSignal I/O:Software Buschngetchnget
Reads data from the software bus.
Description
Reads 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).
Syntaxival chnget Snamekval chnget Snameaval chnget SnameSval chnget SnameSval chngetks Snameival[] chngeti Sname[]kval[] chngetk Sname[]aval[] chngeta Sname[]Sval[] chngets Sname[]InitializationSname -- a string that identifies a channel
of the named software bus to read.
Sname[] -- an array of named software channels to query.
ival -- the control value read at i-time.
Sval -- the string value read at i-time.
ival[] -- an array of control values read at i-time.
Sval{} -- an array of strings read at i-time.
Performancekval -- the control value read at performance time.
kval[] -- an array of control values read at performance time.
aval -- the audio signal read at performance time.
aval[] -- the array of audio vectors read at performance time.
Sval -- the string value read at
k-rate. The chnget opcode works both at i-time and perf-time,
whereas chngetks works only at perf-time. String variables are only
updated if the channel has changed.
Although it is possible to loop through channel names from an array with chnget and chnset,
using the array based variants is more efficient.
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
kr= 100
ksmps= 1
instr 1
kc chnget "cutoff"
a1 oscil p4, p5, 100
a2 lowpass2 a1, kc, 200
out a2
endin
Here is another example of the chnget opcode. It uses the file chnget.csd.
Example of the chnget opcode.See alsoSoftware BusCreditsAuthor: &nameistvan;2005Array based channel opcodes added in version 6.14 - Rory Walsh