SynthDefDecompiler

digraph InheritanceGraph { graph [bgcolor=transparent, color=lightsteelblue2, fontname=Arial, fontsize=10, outputorder=edgesfirst, overlap=prism, penwidth=2, rankdir=LR, splines=spline, style="dashed, rounded", truecolor=true]; node [colorscheme=pastel19, fontname=Arial, fontsize=10, height=0, penwidth=2, shape=box, style="filled, rounded", width=0]; edge [color=lightslategrey, penwidth=1]; subgraph cluster_builtins { graph [label=builtins]; node [color=1]; "builtins.object" [URL="https://docs.python.org/3.6/library/functions.html#object", label=object, target=_top]; } subgraph "cluster_supriya.synthdefs" { graph [label="supriya.synthdefs"]; node [color=2]; "supriya.synthdefs.SynthDefDecompiler.SynthDefDecompiler" [URL="../api/supriya/synthdefs/SynthDefDecompiler.html#supriya.synthdefs.SynthDefDecompiler.SynthDefDecompiler", color=black, fontcolor=white, label="Synth\nDef\nDecompiler", target=_top]; } subgraph "cluster_supriya.system" { graph [label="supriya.system"]; node [color=3]; "supriya.system.SupriyaObject.SupriyaObject" [URL="../api/supriya/synthdefs/../system/SupriyaObject.html#supriya.system.SupriyaObject.SupriyaObject", label="Supriya\nObject", target=_top]; } "builtins.object" -> "supriya.system.SupriyaObject.SupriyaObject"; "supriya.system.SupriyaObject.SupriyaObject" -> "supriya.synthdefs.SynthDefDecompiler.SynthDefDecompiler"; }

class supriya.synthdefs.SynthDefDecompiler.SynthDefDecompiler[source]

SynthDef decompiler.

>>> import supriya.synthdefs
>>> import supriya.ugens
>>> with supriya.synthdefs.SynthDefBuilder(
...     frequency=440,
...     trigger=supriya.synthdefs.Parameter(
...         value=0.,
...         parameter_rate=supriya.synthdefs.ParameterRate.TRIGGER,
...         ),
...     ) as builder:
...     sin_osc = supriya.ugens.SinOsc.ar(frequency=builder['frequency'])
...     decay = supriya.ugens.Decay.kr(
...         decay_time=0.5,
...         source=builder['trigger'],
...         )
...     enveloped_sin = sin_osc * decay
...     out = supriya.ugens.Out.ar(bus=0, source=enveloped_sin)
...
>>> synthdef = builder.build()
>>> graph(synthdef)  
>>> print(synthdef)
synthdef:
    name: 001520731aee5371fefab6b505cf64dd
    ugens:
    -   TrigControl.kr: null
    -   Decay.kr:
            decay_time: 0.5
            source: TrigControl.kr[0:trigger]
    -   Control.kr: null
    -   SinOsc.ar:
            frequency: Control.kr[0:frequency]
            phase: 0.0
    -   BinaryOpUGen(MULTIPLICATION).ar:
            left: SinOsc.ar[0]
            right: Decay.kr[0]
    -   Out.ar:
            bus: 0.0
            source[0]: BinaryOpUGen(MULTIPLICATION).ar[0]
>>> compiled_synthdef = synthdef.compile()
>>> sdd = supriya.synthdefs.SynthDefDecompiler
>>> decompiled_synthdef = sdd.decompile_synthdefs(compiled_synthdef)[0]
>>> graph(decompiled_synthdef)  
>>> print(decompiled_synthdef)
synthdef:
    name: 001520731aee5371fefab6b505cf64dd
    ugens:
    -   TrigControl.kr: null
    -   Decay.kr:
            decay_time: 0.5
            source: TrigControl.kr[0:trigger]
    -   Control.kr: null
    -   SinOsc.ar:
            frequency: Control.kr[0:frequency]
            phase: 0.0
    -   BinaryOpUGen(MULTIPLICATION).ar:
            left: SinOsc.ar[0]
            right: Decay.kr[0]
    -   Out.ar:
            bus: 0.0
            source[0]: BinaryOpUGen(MULTIPLICATION).ar[0]
>>> str(synthdef) == str(decompiled_synthdef)
True

Attributes Summary

decompile_synthdef
decompile_synthdefs

Special methods

(SupriyaObject).__repr__()

Return repr(self).


Class & static methods

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