Get standard arguments of a synthdef as a dictionary or array?

Hello, i want to get the standard arguments as pairs/array or dictionary or from a synth def.
Lets say i have this SynthDef:

	|amp = 0.3, freq = 220, rel = 1|,!2)*,0,rel,doneAction:2));


Then i want a function or method that gives me [\amp, 0.3, \freq, 220, \rel, 1] or something similar. The arguments might also be initialized in the synthdef by \ or something.

Is this possible somehow? It would help me out a lot.
Thank you!

Like this!\test_synth).controlDict.collect(_.defaultValue)

Thank you very much, especially for the quick response, keeps me coding (:

Your welcome!
Take a peek at SynthDesc and ControlName if you want to see why this works.

1 Like

Interesting, I didn’t know you could just do .at directly with the Synth name, I thought you had to go through the \global SynthDescLib. Anyhow, I did something similar (maybe with a bit fancier output, and including things like lag info) for Bacalao:

is there a way to do this without writing a synthdef? could I all the parameters in a function?

Yes, take a look at the documentation for FunctionDef. As a quick example, you can get the argument names as an array with {...}.def.argNames

thanks! Do you know if there is any way to get it to work with the named control method?



NamedControls are not function arguments, so they are not visible as function argument names.

That’s why the initial suggestion was to go through the SynthDesc – because the SynthDesc reports all controls, whether they were created from function arguments or NamedControl.


FYI: when you call {...some function...}.play it converts it to a synthdef behind the scenes.

I always figured that the temp synth def that playing a function creates was not really “cataloged” or stored in the same way a synthdef(\symbol).add is? Thus, not accessible through SynthDescLib?

Yes you are right, Synthdef(...).add will catalogue it with SynthDescLib whereas doesn’t do this as it is considered a temporary. I only mentioned it because your initial question sounded like you wanted to avoid SynthDefs entirely — which isn’t possible —, and it might not be obvious to some that is just a wrapper around SynthDef.