chnsetSignal I/O:Software Buschnsetchnset
Writes data to the named software bus.
Description
Write to a channel of the named software bus. Implies declaring the
channel with imod=2 (see also
chn_k, chn_a, and chn_S).
Syntaxchnset ival, Snamechnset kval, Snamechnset aval, Snamechnset Sval, Snamechnsetks Sval, Snamechnseti ival[], []Snamechnsetk kval[], []Snamechnseta aval[], []Snamechnsets Sval[], []SnameInitializationSname -- a string that indicates which
named channel of the software bus to write.
Sname[] -- an array of string that indicates which
named channels of the software bus to write to.
ival -- the control value to write at i-time.
ival[] -- an array of control values to write at i-time.
Sval -- the string value to write at i-time.
Sval[] -- an array of string values to write at i-time.
Performancekval -- the control value to write at performance
time.
aval -- the audio signal to write at performance
time.
Sval -- the string value to write at
perf-time. The opcode chnset with strings works at both i- and
perf-time, whereas chnsetks works only a perf-time. Channel
contents are only updated if the string variable is modified.
kval[] -- an array of control values to write at performance
time.
aval[] -- an array of audio vectors to write at performance
time.
Although it is possible to loop through channel names from an array with chnget and chnset,
using the array based channel opcodes is more efficient.
Example
The example shows the software bus being used to write pitch
information to a controlling program.
sr= 44100
kr= 100
ksmps= 1
instr 1
a1 in
kp,ka pitchamdf a1
chnset kp, "pitch"
endin
Here is another example of the chnset opcode. It uses the file chnset.csd.
Example of the chnset opcode.See alsoSoftware BusCreditsAuthor: &nameistvan;2005Array based channel opcodes added in version 6.14 - Rory Walsh