Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with nested arrays as synth args #22

Open
dyfer opened this issue Jun 16, 2021 · 0 comments
Open

Issue with nested arrays as synth args #22

dyfer opened this issue Jun 16, 2021 · 0 comments

Comments

@dyfer
Copy link
Contributor

dyfer commented Jun 16, 2021

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant