Skip to content

Issue with nested arrays as synth args #22

Description

@dyfer

Hi Josh,

I've found a peculiar issue with CtkNoteObjects: arrays of arrays don't work as expected when passed as synth arguments. Compare:

(
SynthDef(\arrarr, {|out = 0, dur = 10|
	var freq = \freq.kr([[200, 300]]);
	Out.ar(out, SinOsc.ar(freq) * -12.dbamp);
}).add
)
~synth.free; ~synth = Synth(\arrarr); // default args ok
~synth.free; ~synth = Synth(\arrarr, [\freq, [[500, 600]]]); // both args passed as expected

vs

(
~sd = CtkSynthDef(\arrarr, {|out = 0, dur = 10|
	var freq = \freq.kr([[200, 300]]);
	Out.ar(out, SinOsc.ar(freq) * -12.dbamp);
})
)
~note.free; ~note = ~sd.note.play; // default args ok
~note.free; ~note = ~sd.note.freq_([[500, 600]]).play; // does not pass the args correctly
~note.free; ~note = ~sd.note.freq_([500, 600]).play; // this works however

Of course in this case I don't need to use nested arrays, but I've encountered this when passing Env as an arg to IEnvGen, which returns a nested array for Env().asArrayForInterpolation, i.e. I needed to be able to pass the nested array. (In that case the workaround is to flatten the array when passing before using it with Ctk).

It seems that with plain nodes arrays are flattened when passed to the server. Should Ctk be doing that too?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions