SynthDefDecompiler

class supriya.tools.synthdeftools.SynthDefDecompiler[source]
>>> from supriya.tools import synthdeftools
>>> from supriya.tools import ugentools
>>> with synthdeftools.SynthDefBuilder(
...     frequency=440,
...     trigger=synthdeftools.Parameter(
...         value=0.,
...         parameter_rate=synthdeftools.ParameterRate.TRIGGER,
...         ),
...     ) as builder:
...     sin_osc = ugentools.SinOsc.ar(frequency=builder['frequency'])
...     decay = ugentools.Decay.kr(
...         decay_time=0.5,
...         source=builder['trigger'],
...         )
...     enveloped_sin = sin_osc * decay
...     out = ugentools.Out.ar(bus=0, source=enveloped_sin)
...
>>> synthdef = builder.build()
>>> print(synthdef)
SynthDef 001520731aee5371fefab6b505cf64dd {
    0_TrigControl[0:trigger] -> 1_Decay[0:source]
    const_0:0.5 -> 1_Decay[1:decay_time]
    2_Control[0:frequency] -> 3_SinOsc[0:frequency]
    const_1:0.0 -> 3_SinOsc[1:phase]
    3_SinOsc[0] -> 4_BinaryOpUGen:MULTIPLICATION[0:left]
    1_Decay[0] -> 4_BinaryOpUGen:MULTIPLICATION[1:right]
    const_1:0.0 -> 5_Out[0:bus]
    4_BinaryOpUGen:MULTIPLICATION[0] -> 5_Out[1:source]
}
>>> compiled_synthdef = synthdef.compile()
>>> sdd = synthdeftools.SynthDefDecompiler
>>> decompiled_synthdef = sdd.decompile_synthdefs(compiled_synthdef)[0]
>>> print(decompiled_synthdef)
SynthDef 001520731aee5371fefab6b505cf64dd {
    0_TrigControl[0:trigger] -> 1_Decay[0:source]
    const_0:0.5 -> 1_Decay[1:decay_time]
    2_Control[0:frequency] -> 3_SinOsc[0:frequency]
    const_1:0.0 -> 3_SinOsc[1:phase]
    3_SinOsc[0] -> 4_BinaryOpUGen:MULTIPLICATION[0:left]
    1_Decay[0] -> 4_BinaryOpUGen:MULTIPLICATION[1:right]
    const_1:0.0 -> 5_Out[0:bus]
    4_BinaryOpUGen:MULTIPLICATION[0] -> 5_Out[1:source]
}
>>> str(synthdef) == str(decompiled_synthdef)
True

Lineage

digraph InheritanceGraph { graph [background=transparent, bgcolor=transparent, color=lightslategrey, fontname=Arial, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, root="__builtin__.object", splines=spline, style="dotted, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=12, penwidth=2, style="filled, rounded"]; edge [color=lightsteelblue2, penwidth=2]; subgraph cluster_builtins { graph [label=builtins]; "builtins.object" [color=1, group=0, label=object, shape=box]; } subgraph cluster_synthdeftools { graph [label=synthdeftools]; "supriya.tools.synthdeftools.SynthDefDecompiler.SynthDefDecompiler" [color=black, fontcolor=white, group=1, label=<<B>SynthDefDecompiler</B>>, shape=box, style="filled, rounded"]; } subgraph cluster_systemtools { graph [label=systemtools]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" [color=3, group=2, label=AbstractBase, shape=box]; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" [color=3, group=2, label=SupriyaObject, shape=box]; "supriya.tools.systemtools.SupriyaObject.AbstractBase" -> "supriya.tools.systemtools.SupriyaObject.SupriyaObject"; } "builtins.object" -> "supriya.tools.systemtools.SupriyaObject.AbstractBase"; "supriya.tools.systemtools.SupriyaObject.SupriyaObject" -> "supriya.tools.synthdeftools.SynthDefDecompiler.SynthDefDecompiler"; }

Bases

Attribute summary

decompile_synthdef(value)
decompile_synthdefs(value)
__eq__(expr) Is true when ID of expr equals ID of Supriya object.
__format__([format_specification]) Formats Supriya object.
__hash__() Hashes Supriya object.
__repr__() Gets interpreter representation of Supriya object.

Class & static methods

static SynthDefDecompiler.decompile_synthdef(value)[source]
static SynthDefDecompiler.decompile_synthdefs(value)[source]

Special methods

(SupriyaObject).__eq__(expr)

Is true when ID of expr equals ID of Supriya object. Otherwise false.

Returns boolean.

(SupriyaObject).__format__(format_specification='')

Formats Supriya object.

Set format_specification to ‘’ or ‘storage’. Interprets ‘’ equal to ‘storage’.

Returns string.

(SupriyaObject).__hash__()

Hashes Supriya object.

Required to be explicitely re-defined on Python 3 if __eq__ changes.

Returns integer.

(SupriyaObject).__repr__()

Gets interpreter representation of Supriya object.

Returns string.