Session

class supriya.tools.nonrealtimetools.Session(input_bus_channel_count=None, output_bus_channel_count=None, input_=None, name=None, padding=None)[source]

A non-realtime session.

>>> from supriya.tools import nonrealtimetools
>>> session = nonrealtimetools.Session()
>>> from supriya.tools import synthdeftools
>>> from supriya.tools import ugentools
>>> builder = synthdeftools.SynthDefBuilder(frequency=440)
>>> with builder:
...     out = ugentools.Out.ar(
...         source=ugentools.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

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_nonrealtimetools { graph [label=nonrealtimetools]; "supriya.tools.nonrealtimetools.Session.Session" [color=black, fontcolor=white, group=1, label=<<B>Session</B>>, shape=box, style="filled, rounded"]; } "builtins.object" -> "supriya.tools.nonrealtimetools.Session.Session"; }

Bases

  • builtins.object

Attribute summary

active_moments
add_buffer([channel_count, duration, ...])
add_buffer_group([buffer_count, ...])
add_bus([calculation_rate])
add_bus_group([bus_count, calculation_rate])
add_group([add_action, duration, offset])
add_synth([add_action, duration, synthdef, ...])
at(offset[, propagate])
audio_input_bus_group
audio_output_bus_group
buffers
buses
cue_soundfile(file_path[, channel_count, ...])
duration
from_project_settings(project_settings[, ...])
input_
input_bus_channel_count
inscribe(pattern[, duration, offset, seed])
is_session_like(expr)
move_node(node[, add_action, offset])
name
nodes
offsets
options
output_bus_channel_count
padding
rebuild_transitions()
render([output_file_path, debug, duration, ...])
report()
root_node
set_rand_seed([rand_id, rand_seed, offset])
states
to_datagram([duration])
to_lists([duration, header_format, ...])
to_osc_bundles([duration, header_format, ...])
to_strings([include_controls, include_timespans])
transcript
__graph__([include_controls])
__render__([output_file_path, ...])
__session__()

Read-only properties

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

Methods

Session.add_buffer(channel_count=None, duration=None, frame_count=None, starting_frame=None, file_path=None, offset=None)[source]
Session.add_buffer_group(buffer_count=1, channel_count=None, duration=None, frame_count=None, offset=None)[source]
Session.add_bus(calculation_rate='control')[source]
Session.add_bus_group(bus_count=1, calculation_rate='control')[source]
Session.add_group(add_action=None, duration=None, offset=None)[source]
Session.add_synth(add_action=None, duration=None, synthdef=None, offset=None, **synth_kwargs)[source]
Session.at(offset, propagate=True)[source]
Session.cue_soundfile(file_path, channel_count=None, duration=None, frame_count=32768, starting_frame=0, offset=None)[source]
Session.inscribe(pattern, duration=None, offset=None, seed=None)[source]
Session.move_node(node, add_action=None, offset=None)[source]
Session.rebuild_transitions()[source]
Session.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]
Session.report()[source]
Session.set_rand_seed(rand_id=0, rand_seed=0, offset=None)[source]
Session.to_datagram(duration=None)[source]
Session.to_lists(duration=None, header_format=HeaderFormat.AIFF, sample_format=SampleFormat.INT24, sample_rate=44100)[source]
Session.to_osc_bundles(duration=None, header_format=HeaderFormat.AIFF, sample_format=SampleFormat.INT24, sample_rate=44100)[source]
Session.to_strings(include_controls=False, include_timespans=False)[source]

Class & static methods

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

Special methods

Session.__graph__(include_controls=False)[source]
Session.__render__(output_file_path=None, render_directory_path=None, **kwargs)[source]
Session.__session__()[source]