transport¶
- class EventHandler(events, fs=48000.0)¶
Bases:
object- Parameters
events (array) – An array of events that should be handled
fs (float) – sample frequency of the handler, used to calculate a value of time
- sample_callback(sample)¶
- Parameters
sample (in) – The current sample that should be used to calculate any events or values
- class EventSequencer(events, fs=48000.0, sequence=[])¶
Bases:
object- Parameters
events (array) – An array of events that should be handled
fs (float) – sample frequency of the handler, used to calculate a value of time
sequence (array(int)) – An array of sample values at which events should be fired
- sample_callback(sample)¶
- Parameters
sample (int) – The current sample that should be used to calculate any events or values
- class GlobalTransport(event_handlers, input_device=0, output_device=0, channels=2, buffer_len=1024, fs=48000.0)¶
Bases:
object- Parameters
event_handlers (array) – An array of event handlers that should sync to this transport
input_device (int) – The input device index. Can be found by running python -m sounddevice and selecting your desired device
output_device (int) – The output device index. Can be found by running python -m sounddevice and selecting your desired device
channels (int) – Number of channels the transport should have
buffer_len (int) – Audio buffer length of each channel
fs (float) – Sampling frequency of the transport in Hz
- Variables
count (int) – The current sample the transport is on
block (array) – An array of audio data that will be output on the next buffer callback
chs – An array of node handlers that will be called for each channel
- get_block()¶
Executed every time an audio buffer is needed
- class NodeHandler(nodes=[], fs=48000.0)¶
Bases:
object- Parameters
nodes (array) – An array of nodes that should be played
fs (float) – sample frequency of the handler, used to calculate a value of time
- add_node(node)¶
- Parameters
node – Node to add to the handler
- sample_callback(sample)¶
- Parameters
sample (int) – The current sample that should be used to calculate any events or values
- Returns
A PCM value representing all the nodes in the node handler mixed together
- Return type
float