Is there any way to get original SynthDef code back from .scsyndef file?

Hi.
I wish everyone is being well.

When I excute code below, It post out the source code of ‘default’ SynthDef.

SynthDescLib.global.synthDescs[\default].def.postcs;

In the same way,
I made another SynthDef, save it as .scsydef file, load to SynthDescLib.global, then try same way.

But It doesn’t responds as it was.

SynthDef()
-> SynthDef:nil

I wonder why there is such a difference.
And I wonder if there is any other way to read the SynthDef’s code back.

Thank you very much.

No.

You’re asking if a binary SynthDef can be decompiled into the original source code. That’s completely impossible in every sense.

Someone very clever might be able to figure out a way to write some kind of source code that would produce the same arrangement of unit generators. But I don’t recall hearing of anyone actually doing it. I’d be happy to be wrong about that, though.

hjh

Thanks for your clear explanation.

I was thinking it would be great if there was a feature within SuperCollider that allows saving synthdef files which can be edited later.

Have a good day!

Best way to do that and retain how you coded it is as an .scd file.

The binary representation has gone through optimizations and sorts that increase efficiency, but would greatly decrease readability.

/*
Josh Parmenter
www.realizedsound.net/josh
*/

I presume you are aware of the SynthDef store method? It does save the defFile, and loads it. The file is kept so you can retrieve it.

or maybe I am missing what you are trying to do.

What the OP wants is to save a binary scsyndef file, and then do some process on the binary file to recover the original source code, character for character, to be able to edit it.

… which is a very complicated way to approach something that can already be done in a simple, direct way (by saving the source code).

hjh

2 Likes

What the OP wants is to save a binary scsyndef file, and then do some process on the binary file to recover the original source code, character for character, to be able to edit it.

Yes, you’re right.

Thanks!

ok since that is not possible then maybe @josh proposal via mine is the least worse option short of miracles :slight_smile: