I’ve been experimenting with serial control lately - thanks to Fredrik’s tutorials - but I’m hitting a little bit of a snag in sending the serial channels to the node I’m working on.
All of the serial messages are being sent on a 6-channel control bus.
If I do something like this:
~nodeX.set(\slider1, \data.kr(0!6))
I’d presumably be bringing all 6 channels into the control for the slider1 (instead of controlling sliders 1 through 6)…
This idea produces an error (The preceding error dump is for ERROR: Message ‘addKr’ not understood.) - so this probably isn’t the proper way to map a bus onto a control node anyway…
Hard to see the full picture because of the limited code excerpt you’ve provided. I assume ~nodeX is a Synth, but I’m not sure what \data represents, nor what kind of argument \slider1 is supposed to be, nor exactly what you mean by “serial control” — do you just mean a collection of several busses with consecutive indices?
This might be way off, but here’s a simple example of working with control busses:
s.boot;
~ctlbus = Bus.control(s, 6); //create bus reference
(
SynthDef.new(\ctlbus, {
arg ctlin=0, out=0;
var sig, ampctl;
ampctl = In.kr(ctlin, 6);
sig = SinOsc.ar((1..6) * 300 - 75, mul:0.1);
sig = sig * ampctl;
sig = Splay.ar(sig);
Out.ar(out, sig);
}).add;
)
x = Synth(\ctlbus, [\ctlin, ~ctlbus]);
~ctlbus.value_(1); //set all 6 control channels to 1
~ctlbus.setn(Array.rand(6,0.0,1.0)); //set all 6 channels randomly
~ctlbus.get(_.postln); //get bus values
~ctlbus.value_(0); //off
x.free;
Sorry, let me see if I can explain it a bit better… It’s a bit of a skill to figure out how much information…
~nodeX is a NodeProxy. I’m actually trying to send serial (10-bit) data for six channels, which is where the “data.kr” comes from…
I’m using this code, but I’d like to send the data to many multiple locations (I think sending to many locations within the Routine is maybe slow or CPU-intensive?) and I’d like to have a little more flexibility about where the data is going, instead of having to change an in-process Routine. Does that make sense? I’m sorry I’m not very good at explaining this, I’m still trying to understand some of these things.
A quick follow-up - maybe this should be in a separate thread -
but if I use the bus with “.asMap” to a nodeProxy, is there any way to use “unset” and preserve the most recent value?