One multichannel Ndef to various controls

Hi all,

I’m just wondering why the following code doesn’t work, trying to map a multichannel proxy by index…

Ndef(\var, {\, 0, \, \}).play;
Ndef(\sins)[0…2] = {[2, 3, 5], 0, [300, 1, 0.5], [200, 0, 0.5])};
Ndef(‘var’).map(\freq, Ndef(‘sins’)[0], \wth, Ndef(‘sins’)[1], \mul, Ndef(‘sins’)[2])

Causes the server to crash…

Many thanks,

.map calls .set, which must convert the args to control inputs so they can be sent as an "/n_set" OSC message. Ndef(\sins)[0] is a function, and converting a function to a control input just returns the value of the function, which in this case is a Ugen. You can’t put a Ugen in an OSC message. So I think there is just no good way to do this with Ndef slots directly. You can, however, convert each individual slot to its own Ndef and then .map them. This works because Ndefs can be converted to control inputs via the BusPlug.asControlInput method. So you might do something like this:

Ndef(\var, {\, 0, \, \}).play;
~params = (freq: [2, 0, 200, 300], wth: [3, 0, 0, 0.5], mul: [5, 0, 0.3, 0.3]);
~params.keysValuesDo {|key, val| Ndef(key, {*val)}) };
Ndef(\var).map(\freq, Ndef(\freq), \wth, Ndef(\wth), \mul, Ndef(\mul));

Got it! Many thanks for your reply PT!