entities¶
-
class Buffer(context: Context, id_: int, completion: Completion | None =
None
)¶ Bases:
ContextObject
A buffer.
- Parameters:
- __enter__() Completion ¶
Enter the buffer’s allocation completion.
-
__render_memo__(output_file_path: PathLike | None =
None
, render_directory_path: PathLike | None =None
, **kwargs) SupportsRender ¶
-
close(on_completion: Callable[[Context], None] | None =
None
) Completion ¶ Close the buffer.
Emit
/b_close
requests.
- copy(*, target_buffer: Buffer, starting_frame: int, target_starting_frame: int, frame_count: int) None ¶
Copy the buffer.
Emit
/b_gen <buffer.id_> copy ...
requests.
- fill(starting_frame: int, frame_count: int, value: float) None ¶
Fill the buffer with a single value.
Emit
/b_fill
requests.
-
free(on_completion: Callable[[Context], None] | None =
None
) Completion ¶ Free the buffer.
Emit
/b_free
requests.
-
generate(command_name: 'sine1' | 'sine2' | 'sine3' | 'cheby', amplitudes: Sequence[float], frequencies: Sequence[float] | None =
None
, phases: Sequence[float] | None =None
, as_wavetable: bool =False
, should_clear_first: bool =False
, should_normalize: bool =False
) None ¶ Generate the buffer.
Emit
/b_gen
requests.- Parameters:
- command_name: 'sine1' | 'sine2' | 'sine3' | 'cheby'¶
The generation command name.
- amplitudes: Sequence[float]¶
A sequence of partial amplitudes.
- frequencies: Sequence[float] | None =
None
¶ A sequence of partial frequencies.
- phases: Sequence[float] | None =
None
¶ A sequence of partial phases.
- as_wavetable: bool =
False
¶ Flag for generating the output in wavetable format.
- should_clear_first: bool =
False
¶ Flag for clearing the buffer before generating.
- should_normalize: bool =
False
¶ Flag for normalizing the generated output.
-
get(*indices: int, sync: bool =
True
) Awaitable[dict[int, float] | None] | dict[int, float] | None ¶ Get a sample.
Emit
/b_get
requests.
-
get_range(index: int, count: int, sync: bool =
True
) Awaitable[Sequence[float] | None] | Sequence[float] | None ¶ Get a sample range.
Emit
/b_getn
requests.
-
normalize(new_maximum: float =
1.0
, as_wavetable: bool =False
) None ¶ Normalize the buffer.
Emit
/b_gen <buffer.id_> (w)?normalize
requests depending on parameters.
-
query(sync: bool =
True
) Awaitable[BufferInfo | None] | BufferInfo | None ¶ Query the buffer.
Emit
/b_query
requests.
-
read(file_path: PathLike, *, buffer_starting_frame: int | None =
None
, channel_indices: list[int] | None =None
, frame_count: int | None =None
, leave_open: bool =False
, on_completion: Callable[[Context], None] | None =None
, starting_frame: int | None =None
) Completion ¶ Read a file into the buffer.
Emit
/b_read
or/b_readChannel
requests, depending on parameters.- Parameters:
- file_path: PathLike¶
The file path to read from.
- channel_indices: list[int] | None =
None
¶ A list of channel indices to read from when reading from a file.
- frame_count: int | None =
None
¶ The number of frames to read.
- leave_open: bool =
False
¶ Flag for leaving the file open (e.g. to continue reading via
DiskIn
) or close it.- starting_frame: int | None =
None
¶ The starting frame in the buffer to begin reading into at.
- on_completion: Callable[[Context], None] | None =
None
¶ A callable with the buffer’s context as the only argument. Permits building an “on completion” argument to this method’s request without an active moment.
-
write(file_path: PathLike, *, frame_count: int | None =
None
, header_format: HeaderFormat | SupportsInt | str | None ='aiff'
, leave_open: bool =False
, on_completion: Callable[[Context], None] | None =None
, sample_format: SampleFormat | SupportsInt | str | None ='int24'
, starting_frame: int | None =None
) Completion ¶ Write the buffer to disk.
Emit
/b_write
requests.- Parameters:
- file_path: PathLike¶
The file path to write into.
- frame_count: int | None =
None
¶ The number of frames to write.
- header_format: HeaderFormat | SupportsInt | str | None =
'aiff'
¶ The header format to use, e.g.
AIFF
orWAVE
.- leave_open: bool =
False
¶ Flag for leaving the file open (e.g. to continue writing via
DiskOut
) or close it.- sample_format: SampleFormat | SupportsInt | str | None =
'int24'
¶ The sample format to use, e.g.
INT24
orFLOAT
.- starting_frame: int | None =
None
¶ The starting frame in the buffer to start writing from.
- on_completion: Callable[[Context], None] | None =
None
¶ A callable with the buffer’s context as the only argument. Permits building an “on completion” argument to this method’s request without an active moment.
-
zero(on_completion: Callable[[Context], None] | None =
None
) Completion ¶ Zero the buffer.
Emit
/b_zero
requests.
-
class BufferGroup(context: Context, id_: int, count: int =
1
)¶ Bases:
ContextObject
A buffer group.
- Parameters:
- __getitem__(item)¶
- __post_init__()¶
- free()¶
Free the buffer group.
Emit
/b_free
requests.
- class Bus(context: Context, id_: int, calculation_rate: CalculationRate)¶
Bases:
ContextObject
A bus.
- Parameters:
- fill(count: int, value: float) None ¶
Fill contiguous buses with a single value, starting with this bus.
Emit
/c_fill
requests.
-
get(sync: bool =
True
) Awaitable[float | None] | float | None ¶ Get the control bus’ value.
Emit
/c_get
requests.
-
get_range(count: int, sync: bool =
True
) Awaitable[Sequence[float] | None] | Sequence[float] | None ¶ Get a range of control bus values.
Emit
/c_getn
requests.
-
class BusGroup(context: Context, id_: int, calculation_rate: CalculationRate, count: int =
1
)¶ Bases:
ContextObject
A bus group.
- Parameters:
- __getitem__(item)¶
- __post_init__()¶
- free()¶
Free the bus group.
Emit no requests.
- class ContextObject(context: Context, id_: int)¶
Bases:
object
Base class for objects with context references.
- Parameters:
-
class Group(context: Context, id_: int, parallel: bool =
False
)¶ Bases:
Node
A group node.
- Parameters:
-
free_children(synths_only: bool =
False
) None ¶ Free the group’s children.
Emit
/g_deepFree
or/g_freeAll
requests depending on parameters.
- class Node(context: Context, id_: int)¶
Bases:
ContextObject
A node.
-
add_group(add_action: AddAction | SupportsInt | str | None =
AddAction.ADD_TO_HEAD
, parallel: bool =False
, permanent: bool =False
) Group ¶ Add a new group relative to this node.
Emit
/g_new
or/p_new
requests depending on parameters.- Parameters:
- add_action: AddAction | SupportsInt | str | None =
AddAction.ADD_TO_HEAD
¶ The add action to use when placing the new group.
- parallel: bool =
False
¶ Flag for parallel vs non-parallel groups.
- permanent: bool =
False
¶ Flag for using a permanent node ID.
- add_action: AddAction | SupportsInt | str | None =
-
add_synth(synthdef: SynthDef, *, add_action: AddAction | SupportsInt | str | None =
AddAction.ADD_TO_HEAD
, permanent: bool =False
, **settings) Synth ¶ Add a new synth relative to this node.
Emit
/s_new
requests.
-
free(force: bool =
False
) None ¶ Free the node.
Emit
/n_free
for groups, for synths without agate
control, or whenforce
isTrue
.Emit
/n_set <node.id_> gate 0
for synths withgate
controls.
- map(**settings: Bus | None) None ¶
Map the node’s controls to buses.
Emit
/n_map
and/n_mapa
requests.
-
move(target_node: Node, add_action: AddAction | SupportsInt | str | None =
None
) None ¶ Move the node.
Emit
/n_after
,/n_before
,/g_head
and/g_tail
requests depending on parameters.- Parameters:
- add_action: AddAction | SupportsInt | str | None =
None
¶ The add action to use when moving the node.
- target_node: Node¶
The target node to place the node relative to.
- add_action: AddAction | SupportsInt | str | None =
-
order(*nodes: Node, add_action: AddAction | SupportsInt | str | None =
None
) None ¶ Re-order nodes relative to the node.
Emit
/n_order
requests.- Parameters:
- *nodes: Node¶
The nodes to re-order.
- add_action: AddAction | SupportsInt | str | None =
None
¶ The add action to use when re-ordering the nodes.
-
query(sync: bool =
True
) Awaitable[NodeInfo | None] | NodeInfo | None ¶ Query the node.
Emit
/n_query
requests.
- set(*indexed_settings: tuple[int, SupportsFloat | Sequence[SupportsFloat]], **settings: SupportsFloat | Sequence[SupportsFloat]) None ¶
Set the node’s controls.
- Parameters:
- *indexed_settings: tuple[int, SupportsFloat | Sequence[SupportsFloat]]¶
A sequence of control indices to values.
- **settings: SupportsFloat | Sequence[SupportsFloat]¶
A mapping of control names to values.
- set_range(*indexed_settings: tuple[int, Sequence[SupportsFloat]], **settings: Sequence[SupportsFloat]) None ¶
Set a range of the node’s controls.
- Parameters:
- *indexed_settings: tuple[int, Sequence[SupportsFloat]]¶
A sequence of control indices to values.
- **settings: Sequence[SupportsFloat]¶
A mapping of control names to values.
-
add_group(add_action: AddAction | SupportsInt | str | None =
- class Synth(context: Context, id_: int, synthdef: SynthDef)¶
Bases:
Node
A synth node.
- Parameters:
-
get(*controls: int | str, sync: bool =
True
) Awaitable[dict[int | str, float] | None] | dict[int | str, float] | None ¶ Get a control.
Emit
/s_get
requests.