My overall goal here is to provide a synth a collection of values in one argument, and the most straightforward way I could think of was to provide an index to a globally available list that contains several arrays of values. In the future it would probably make sense to just directly provide an instance of a class I would write, but this issue is making me think I’m severely overestimating SynthDefs.
I think there must be some rule about SynthDef arguments that I’m missing, most likely related to the idea that SynthDefs must be a defined size when they are interpreted (which I learned the hard way a few hours ago).
Anyway here’s the code block, just an example, but I don’t have a clue why it doesn’t work:
SynthDef(\test, {
arg int = 1;
var array = #[0,1,2,3];
array.at(int.asInteger).postln;
});
The error I’m getting is “Index not an Integer”. Full error at this link
Additional information:
- The function inside the SynthDef works perfectly as a standalone function
- the argument is typed as an OutputProxy, and after asInteger is typed as a UnaryOpUGen
I’d be grateful for any pointers here, and especially grateful for documentation targetting this topic that I could read through. Thanks!