querytree

class QueryTreeControl(control_name_or_index=None, control_value=None)

Bases: supriya.system.SupriyaValueObject

property control_name_or_index
property control_value
classmethod from_control(control)
class QueryTreeGroup(node_id=None, children=None, name=None, **extra)

Bases: supriya.system.SupriyaValueObject, collections.abc.Sequence

__format__(format_spec)

Default object formatter.

__getitem__(item)
__len__()
annotate(annotation_map)
property children
property extra
classmethod from_group(group, include_controls=False)
classmethod from_response(response)
classmethod from_state(state, include_controls=False, include_timespans=False)
property name
property node_id
to_dict()

Convert QueryTreeGroup to JSON-serializable dictionary.

>>> query_tree_group = supriya.querytree.QueryTreeGroup(
...     node_id=1002,
...     children=(
...         supriya.querytree.QueryTreeSynth(
...             node_id=1105,
...             synthdef_name="dca557070c6b57164557041ac746fb3f",
...             controls=(
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="damping",
...                     control_value=0.06623425334692,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="duration",
...                     control_value=3.652155876159668,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="level",
...                     control_value=0.894767701625824,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="out",
...                     control_value=16.0,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="room_size",
...                     control_value=0.918643176555634,
...                 ),
...             ),
...         ),
...         supriya.querytree.QueryTreeSynth(
...             node_id=1098,
...             synthdef_name="cc754c63533fdcf412a44ef6adb1a8f0",
...             controls=(
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="duration",
...                     control_value=5.701356887817383,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="level",
...                     control_value=0.959683060646057,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="out",
...                     control_value=16.0,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="pitch_dispersion",
...                     control_value=0.040342573076487,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="pitch_shift",
...                     control_value=10.517594337463379,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="time_dispersion",
...                     control_value=0.666014134883881,
...                 ),
...                 supriya.querytree.QueryTreeControl(
...                     control_name_or_index="window_size",
...                     control_value=1.014111995697021,
...                 ),
...             ),
...         ),
...     ),
... )
>>> import json
>>> result = query_tree_group.to_dict()
>>> result = json.dumps(
...     result,
...     indent=4,
...     separators=(",", ": "),
...     sort_keys=True,
... )
>>> print(result)
{
    "children": [
        {
            "controls": {
                "damping": 0.06623425334692,
                "duration": 3.652155876159668,
                "level": 0.894767701625824,
                "out": 16.0,
                "room_size": 0.918643176555634
            },
            "node_id": 1105,
            "synthdef": "dca557070c6b57164557041ac746fb3f"
        },
        {
            "controls": {
                "duration": 5.701356887817383,
                "level": 0.959683060646057,
                "out": 16.0,
                "pitch_dispersion": 0.040342573076487,
                "pitch_shift": 10.517594337463379,
                "time_dispersion": 0.666014134883881,
                "window_size": 1.014111995697021
            },
            "node_id": 1098,
            "synthdef": "cc754c63533fdcf412a44ef6adb1a8f0"
        }
    ],
    "node_id": 1002
}
class QueryTreeSynth(node_id=None, synthdef_name=None, controls=None, name=None, **extra)

Bases: supriya.system.SupriyaValueObject, collections.abc.Sequence

__format__(format_spec)

Default object formatter.

__getitem__(item)
__len__()
annotate(annotation_map)
property controls
property extra
classmethod from_response(response)
classmethod from_synth(synth, include_controls=False)
property name
property node_id
property synthdef_name
to_dict()

Convert QueryTreeSynth to JSON-serializable dictionary.

>>> query_tree_synth = supriya.querytree.QueryTreeSynth(
...     node_id=1001,
...     synthdef_name="c1aa521afab5b0c0ce3d744690951649",
...     controls=(
...         supriya.querytree.QueryTreeControl(
...             control_name_or_index="level",
...             control_value=1.0,
...         ),
...         supriya.querytree.QueryTreeControl(
...             control_name_or_index="out",
...             control_value=0.0,
...         ),
...     ),
... )
>>> import json
>>> result = query_tree_synth.to_dict()
>>> result = json.dumps(
...     result,
...     indent=4,
...     separators=(",", ": "),
...     sort_keys=True,
... )
>>> print(result)
{
    "controls": {
        "level": 1.0,
        "out": 0.0
    },
    "node_id": 1001,
    "synthdef": "c1aa521afab5b0c0ce3d744690951649"
}