Integer from an OutputProxy / integer required from an SynthDef arg

The following code generates Error “Index not an Integer” :

var scale = Scale.major;
		arg note;
		var snd =
			scale.degreeToFreq(note, 48.midicps, 0),
		);, [snd, snd]);

and if I use “note.asInteger”, it gives the error “Operator ‘asInteger’ applied to a UGen is not supported in scsynth”.

I’ve found out that an “arg” in a SynthDef is an “OutputProxy”, thus I can’t use the method “asInteger” on it. That’s possibly the reason of it.

What’s the possible workaround of this?

Thank you.

There’s DegreeToKey:

It will require you to store the scale in a buffer, you’ll find examples there in the docs.


1 Like

Hi Meng Qi! For those who don’t know, one of the best synthesizer builders in China has joined us.

Elgiano’s answer is right.

The reason why is that the server can’t do array lookup – arrays are in the language, and the index must be in the language too. If the index is a UGen, then that rule is broken.

But the server can do Buffer lookup.



Thank you for the nice words and detailed explanation! Recently everyone in China is staying at home for disease control, so I started learning SC for fun, what a great programming language.

I am happy to join this warm and highly creative community. :smirk_cat:

1 Like