SynthDefs in Server?

Hello Everyone.

With:
s.numSynthDefs;
it is possible to see the number of current synthdefs known to the server.

Is it also possible to get a list of SynthDef Keynames already stored in the server?

Optionally, is it possible, to have a string or a key and check and receive a True or False for either case if the server knows such a SynthDef or not?

Thank you very much!

Yes. You don’t need to query the server to do this; when you add a SynthDef, a SynthDesc is generated and added to the global instance of SynthDescLib, which you can access at SynthDescLib.global.

SynthDescLib.global.synthDescs returns an IdentityDictionary of SynthDescs, and SynthDescLib.global.synthDescs.keys will return the list (actually an instance of Set) that you’re looking for.

Also yes. SynthDescLib.global.match(\nameOfSynthDef).notNil will return True if the SynthDescLib contains a SynthDesc called \nameOfSynthDef and False otherwise.

1 Like

Oh perfect, thank you very much!

1 Like