Session

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.nonrealtime" { graph [label="supriya.nonrealtime"]; node [color=2]; "supriya.nonrealtime.Session.Session" [URL="../api/supriya/nonrealtime/Session.html#supriya.nonrealtime.Session.Session", color=black, fontcolor=white, label=Session, target=_top]; } "builtins.object" -> "supriya.nonrealtime.Session.Session"; }

class supriya.nonrealtime.Session.Session(input_bus_channel_count=None, output_bus_channel_count=None, input_=None, name=None, padding=None, **kwargs)[source]

A non-realtime session.

>>> import supriya.nonrealtime
>>> session = supriya.nonrealtime.Session()
>>> import supriya.synthdefs
>>> import supriya.ugens
>>> builder = supriya.synthdefs.SynthDefBuilder(frequency=440)
>>> with builder:
...     out = supriya.ugens.Out.ar(
...         source=supriya.ugens.SinOsc.ar(
...             frequency=builder['frequency'],
...             )
...         )
...
>>> synthdef = builder.build()
>>> with session.at(0):
...     synth_a = session.add_synth(duration=10, synthdef=synthdef)
...     synth_b = session.add_synth(duration=15, synthdef=synthdef)
...
>>> with session.at(5):
...     synth_c = session.add_synth(duration=10, synthdef=synthdef)
...
>>> result = session.to_lists(duration=20)
>>> result == [
...     [0.0, [
...         ['/d_recv', bytearray(synthdef.compile(use_anonymous_name=True))],
...         ['/s_new', '9c4eb4778dc0faf39459fa8a5cd45c19', 1000, 0, 0],
...         ['/s_new', '9c4eb4778dc0faf39459fa8a5cd45c19', 1001, 0, 0]]],
...     [5.0, [['/s_new', '9c4eb4778dc0faf39459fa8a5cd45c19', 1002, 0, 0]]],
...     [10.0, [['/n_free', 1000]]],
...     [15.0, [['/n_free', 1001, 1002]]],
...     [20.0, [[0]]],
... ]
True

Attributes Summary

__graph__ Graphs session.
__render__
__repr__ Return repr(self).
__session__
active_moments
add_buffer
add_buffer_group
add_bus
add_bus_group
add_group
add_synth
at
audio_input_bus_group
audio_output_bus_group
buffers
buses
cue_soundfile
duration
from_project_settings
input_
input_bus_channel_count
inscribe
is_session_like
move_node
name
nodes
offsets
options
output_bus_channel_count
padding
rebuild_transitions
render
root_node
set_rand_seed
states
to_lists
to_osc_bundles
to_strings
transcript

Special methods

__graph__()[source]

Graphs session.

TODO: Get graphviz to respect node order or reimplement as pure SVG.

>>> session = supriya.Session()
>>> with session.at(0):
...     group = session.add_group()
...     synth_a = group.add_synth(duration=15)
...
>>> with session.at(5):
...     synth_b = group.add_synth(duration=15)
...     synth_c = group.add_synth(duration=5)
...
>>> with session.at(7.5):
...     synth_d = synth_b.add_synth(duration=5, add_action='ADD_BEFORE')
...
>>> with session.at(11):
...     _ = synth_d.move_node(synth_a, add_action='ADD_AFTER')
...
>>> supriya.graph(session)  
>>> graphviz_graph = session.__graph__()
>>> print(format(graphviz_graph, 'graphviz'))
digraph G {
    graph [bgcolor=transparent,
        fontname=Arial,
        penwidth=2,
        rankdir=LR,
        ranksep=1.5];
    node [fontname=Arial,
        fontsize=12,
        penwidth=2,
        shape=Mrecord,
        style="filled, rounded"];
    edge [penwidth=2];
    subgraph cluster_0 {
        graph [label="[-inf]",
            style="solid, rounded"];
    }
    subgraph cluster_1 {
        graph [label="[0.0]",
            style="solid, rounded"];
        subgraph cluster_1_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_1_0_0 [label="{ { <f_0_0_0> [1001] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
        }
    }
    subgraph cluster_2 {
        graph [label="[5.0]",
            style="solid, rounded"];
        subgraph cluster_2_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_2_0_0 [label="{ { <f_0_0_0> [1003] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_2_0_1 [label="{ { <f_0_0_0> [1002] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_2_0_2 [label="{ { <f_0_0_0> [1001] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_2_0_0 -> node_2_0_1;
            node_2_0_1 -> node_2_0_2;
        }
    }
    subgraph cluster_3 {
        graph [label="[7.5]",
            style="solid, rounded"];
        subgraph cluster_3_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_3_0_0 [label="{ { <f_0_0_0> [1003] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_3_0_1 [label="{ { <f_0_0_0> [1004] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_3_0_2 [label="{ { <f_0_0_0> [1002] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_3_0_3 [label="{ { <f_0_0_0> [1001] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_3_0_0 -> node_3_0_1;
            node_3_0_1 -> node_3_0_2;
            node_3_0_2 -> node_3_0_3;
        }
    }
    subgraph cluster_4 {
        graph [label="[10.0]",
            style="solid, rounded"];
        subgraph cluster_4_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_4_0_0 [label="{ { <f_0_0_0> [1004] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_4_0_1 [label="{ { <f_0_0_0> [1002] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_4_0_2 [label="{ { <f_0_0_0> [1001] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_4_0_0 -> node_4_0_1;
            node_4_0_1 -> node_4_0_2;
        }
    }
    subgraph cluster_5 {
        graph [label="[11.0]",
            style="solid, rounded"];
        subgraph cluster_5_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_5_0_0 [label="{ { <f_0_0_0> [1004] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_5_0_1 [label="{ { <f_0_0_0> [1001] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_5_0_2 [label="{ { <f_0_0_0> [1002] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_5_0_0 -> node_5_0_1;
            node_5_0_1 -> node_5_0_2;
        }
    }
    subgraph cluster_6 {
        graph [label="[12.5]",
            style="solid, rounded"];
        subgraph cluster_6_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_6_0_0 [label="{ { <f_0_0_0> [1001] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_6_0_1 [label="{ { <f_0_0_0> [1002] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
            node_6_0_0 -> node_6_0_1;
        }
    }
    subgraph cluster_7 {
        graph [label="[15.0]",
            style="solid, rounded"];
        subgraph cluster_7_0 {
            graph [label="1000",
                style="dashed, rounded"];
            node_7_0_0 [label="{ { <f_0_0_0> [1002] | <f_0_0_1> default | <f_0_0_2> amplitude: 0.1 | <f_0_0_3> frequency: 440.0 | <f_0_0_4> gate: 1.0 | <f_0_0_5> out: 0.0 | <f_0_0_6> pan: 0.5 } }"];
        }
    }
    subgraph cluster_8 {
        graph [label="[20.0]",
            style="solid, rounded"];
        subgraph cluster_8_0 {
            graph [label="1000",
                style="dashed, rounded"];
        }
    }
    subgraph cluster_9 {
        graph [label="[inf]",
            style="solid, rounded"];
    }
    node_1_0_0:f_0_0_0 -> node_2_0_2:f_0_0_0;
    node_2_0_0:f_0_0_0 -> node_3_0_0:f_0_0_0;
    node_2_0_1:f_0_0_0 -> node_3_0_2:f_0_0_0;
    node_2_0_2:f_0_0_0 -> node_3_0_3:f_0_0_0;
    node_3_0_1:f_0_0_0 -> node_4_0_0:f_0_0_0;
    node_3_0_2:f_0_0_0 -> node_4_0_1:f_0_0_0;
    node_3_0_3:f_0_0_0 -> node_4_0_2:f_0_0_0;
    node_4_0_0:f_0_0_0 -> node_5_0_0:f_0_0_0;
    node_4_0_1:f_0_0_0 -> node_5_0_2:f_0_0_0;
    node_4_0_2:f_0_0_0 -> node_5_0_1:f_0_0_0;
    node_5_0_1:f_0_0_0 -> node_6_0_0:f_0_0_0;
    node_5_0_2:f_0_0_0 -> node_6_0_1:f_0_0_0;
    node_6_0_1:f_0_0_0 -> node_7_0_0:f_0_0_0;
}
__render__(output_file_path=None, render_directory_path=None, **kwargs)[source]
__repr__()[source]

Return repr(self).

__session__()[source]

Methods

add_buffer(channel_count=None, duration=None, frame_count=None, starting_frame=None, file_path=None, offset=None)[source]
add_buffer_group(buffer_count=1, channel_count=None, duration=None, frame_count=None, offset=None)[source]
add_bus(calculation_rate='control')[source]
add_bus_group(bus_count=1, calculation_rate='control')[source]
add_group(add_action=None, duration=None, offset=None)[source]
add_synth(add_action=None, duration=None, synthdef=None, offset=None, **synth_kwargs)[source]
at(offset, propagate=True)[source]
cue_soundfile(file_path, channel_count=None, duration=None, frame_count=32768, starting_frame=0, offset=None)[source]
inscribe(pattern, duration=None, offset=None, seed=None)[source]
move_node(node, add_action=None, offset=None)[source]
rebuild_transitions()[source]
render(output_file_path=None, debug=None, duration=None, header_format=HeaderFormat.AIFF, input_file_path=None, render_directory_path=None, sample_format=SampleFormat.INT24, sample_rate=44100, print_transcript=None, transcript_prefix=None, **kwargs)[source]
set_rand_seed(rand_id=0, rand_seed=0, offset=None)[source]
to_lists(duration=None, header_format=HeaderFormat.AIFF, sample_format=SampleFormat.INT24, sample_rate=44100)[source]
to_osc_bundles(duration=None, header_format=HeaderFormat.AIFF, sample_format=SampleFormat.INT24, sample_rate=44100)[source]
to_strings(include_controls=False, include_timespans=False)[source]

Class & static methods

classmethod from_project_settings(project_settings, input_=None, name=None, padding=None)[source]
static is_session_like(expr)[source]

Read-only properties

active_moments
audio_input_bus_group
audio_output_bus_group
buffers
buses
duration
input_
input_bus_channel_count
name
nodes
offsets
options
output_bus_channel_count
padding
root_node
states
transcript