From dd3bc194a8c90e7ae01ac7d3e602886ea4ef9d0d Mon Sep 17 00:00:00 2001 From: Daniel Jones Date: Sat, 12 Oct 2024 22:56:55 +0100 Subject: [PATCH] Add docs and stubs for new nodes --- .../libs/signalflow-stubs/signalflow.pyi | 25 +++++++++++++++++-- .../buffer/historybufferwriter/index.md | 13 ++++++++++ docs/library/envelope/accumulator/index.md | 13 ++++++++++ docs/library/operators/bus/index.md | 13 ++++++++++ docs/library/operators/channeloffset/index.md | 13 ++++++++++ docs/library/operators/selectinput/index.md | 13 ++++++++++ docs/library/sequencing/triggermult/index.md | 13 ++++++++++ .../sequencing/triggerroundrobin/index.md | 13 ++++++++++ 8 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 docs/library/buffer/historybufferwriter/index.md create mode 100644 docs/library/envelope/accumulator/index.md create mode 100644 docs/library/operators/bus/index.md create mode 100644 docs/library/operators/channeloffset/index.md create mode 100644 docs/library/operators/selectinput/index.md create mode 100644 docs/library/sequencing/triggermult/index.md create mode 100644 docs/library/sequencing/triggerroundrobin/index.md diff --git a/auxiliary/libs/signalflow-stubs/signalflow.pyi b/auxiliary/libs/signalflow-stubs/signalflow.pyi index 8bc5ad90..886bdddd 100644 --- a/auxiliary/libs/signalflow-stubs/signalflow.pyi +++ b/auxiliary/libs/signalflow-stubs/signalflow.pyi @@ -10,7 +10,7 @@ from __future__ import annotations import numpy import typing import typing_extensions -__all__ = ['ADSREnvelope', 'ASREnvelope', 'Abs', 'Accumulator', 'Add', 'AllpassDelay', 'AmplitudeToDecibels', 'AudioGraph', 'AudioGraphConfig', 'AudioIOException', 'AudioIn', 'AudioOut', 'AudioOut_Abstract', 'AudioOut_Dummy', 'AzimuthPanner', 'BeatCutter', 'BiquadFilter', 'Buffer', 'Buffer2D', 'BufferLooper', 'BufferPlayer', 'BufferRecorder', 'Bus', 'CPUUsageAboveLimitException', 'ChannelArray', 'ChannelCrossfade', 'ChannelMixer', 'ChannelOffset', 'ChannelPanner', 'ChannelSelect', 'Clip', 'ClockDivider', 'CombDelay', 'Compressor', 'Constant', 'Cos', 'Counter', 'CrossCorrelate', 'DCFilter', 'DecibelsToAmplitude', 'DetectSilence', 'DeviceNotFoundException', 'Divide', 'EQ', 'Envelope', 'EnvelopeBuffer', 'Equal', 'Euclidean', 'FFT', 'FFTBuffer', 'FFTBufferPlayer', 'FFTContinuousPhaseVocoder', 'FFTContrast', 'FFTConvolve', 'FFTCrossFade', 'FFTFindPeaks', 'FFTLFO', 'FFTLPF', 'FFTMagnitudePhaseArray', 'FFTNode', 'FFTNoiseGate', 'FFTOpNode', 'FFTPhaseVocoder', 'FFTRandomPhase', 'FFTScaleMagnitudes', 'FFTTonality', 'FFTTransform', 'FeedbackBufferReader', 'FeedbackBufferWriter', 'FlipFlop', 'Fold', 'FrequencyToMidiNote', 'Gate', 'Granulator', 'GraphAlreadyCreatedException', 'GraphNotCreatedException', 'GreaterThan', 'GreaterThanOrEqual', 'HistoryBufferWriter', 'IFFT', 'If', 'Impulse', 'ImpulseSequence', 'Index', 'InsufficientBufferSizeException', 'InvalidChannelCountException', 'KDTree', 'KDTreeMatch', 'LFO', 'Latch', 'LessThan', 'LessThanOrEqual', 'Line', 'Logistic', 'Maximiser', 'MidiNoteToFrequency', 'Modulo', 'MoogVCF', 'MouseDown', 'MouseX', 'MouseY', 'Multiply', 'NearestNeighbour', 'Node', 'NodeAlreadyPlayingException', 'NodeNotPlayingException', 'NodeRegistry', 'NotEqual', 'OneTapDelay', 'OnsetDetector', 'Patch', 'PatchFinishedPlaybackException', 'PatchRegistry', 'PatchSpec', 'PinkNoise', 'Pow', 'RMS', 'RandomBrownian', 'RandomChoice', 'RandomCoin', 'RandomExponential', 'RandomExponentialDist', 'RandomGaussian', 'RandomImpulse', 'RandomImpulseSequence', 'RandomUniform', 'RectangularEnvelope', 'Resample', 'Round', 'RoundToScale', 'SIGNALFLOW_DEFAULT_BLOCK_SIZE', 'SIGNALFLOW_DEFAULT_FFT_HOP_SIZE', 'SIGNALFLOW_DEFAULT_FFT_SIZE', 'SIGNALFLOW_DEFAULT_SAMPLE_RATE', 'SIGNALFLOW_DEFAULT_TRIGGER', 'SIGNALFLOW_EVENT_DISTRIBUTION_POISSON', 'SIGNALFLOW_EVENT_DISTRIBUTION_UNIFORM', 'SIGNALFLOW_FILTER_TYPE_BAND_PASS', 'SIGNALFLOW_FILTER_TYPE_HIGH_PASS', 'SIGNALFLOW_FILTER_TYPE_HIGH_SHELF', 'SIGNALFLOW_FILTER_TYPE_LOW_PASS', 'SIGNALFLOW_FILTER_TYPE_LOW_SHELF', 'SIGNALFLOW_FILTER_TYPE_NOTCH', 'SIGNALFLOW_FILTER_TYPE_PEAK', 'SIGNALFLOW_INTERPOLATION_MODE_COSINE', 'SIGNALFLOW_INTERPOLATION_MODE_LINEAR', 'SIGNALFLOW_INTERPOLATION_MODE_NONE', 'SIGNALFLOW_MAX_CHANNELS', 'SIGNALFLOW_MAX_FFT_SIZE', 'SIGNALFLOW_NODE_BUFFER_SIZE', 'SIGNALFLOW_NODE_INITIAL_OUTPUT_CHANNELS', 'SIGNALFLOW_NODE_STATE_ACTIVE', 'SIGNALFLOW_NODE_STATE_STOPPED', 'SIGNALFLOW_PATCH_STATE_ACTIVE', 'SIGNALFLOW_PATCH_STATE_STOPPED', 'SVFilter', 'SampleAndHold', 'SawLFO', 'SawOscillator', 'ScaleLinExp', 'ScaleLinLin', 'SegmentPlayer', 'SegmentedGranulator', 'SelectInput', 'Sequence', 'Sin', 'SineLFO', 'SineOscillator', 'Smooth', 'SpatialEnvironment', 'SpatialPanner', 'SpatialSpeaker', 'SquareLFO', 'SquareOscillator', 'Squiz', 'StereoBalance', 'StereoPanner', 'StereoWidth', 'StochasticNode', 'Stutter', 'Subtract', 'Sum', 'Tan', 'Tanh', 'TimeShift', 'TriangleLFO', 'TriangleOscillator', 'TriggerMult', 'TriggerRoundRobin', 'UnknownTriggerNameException', 'VampAnalysis', 'WaveShaper', 'WaveShaperBuffer', 'Wavetable', 'Wavetable2D', 'WavetableBuffer', 'WetDry', 'WhiteNoise', 'Wrap', 'amplitude_to_db', 'clip', 'db_to_amplitude', 'fold', 'frequency_to_midi_note', 'midi_note_to_frequency', 'random_exponential', 'random_integer', 'random_seed', 'random_uniform', 'save_block_to_text_file', 'save_block_to_wav_file', 'scale_exp_lin', 'scale_lin_exp', 'scale_lin_lin', 'signalflow_event_distribution_t', 'signalflow_filter_type_t', 'signalflow_interpolation_mode_t', 'signalflow_node_state_t', 'signalflow_patch_state_t', 'wrap'] +__all__ = ['ADSREnvelope', 'ASREnvelope', 'Abs', 'Accumulator', 'Add', 'AllpassDelay', 'AmplitudeToDecibels', 'AudioGraph', 'AudioGraphConfig', 'AudioIOException', 'AudioIn', 'AudioOut', 'AudioOut_Abstract', 'AudioOut_Dummy', 'AzimuthPanner', 'BeatCutter', 'BiquadFilter', 'Buffer', 'Buffer2D', 'BufferLooper', 'BufferPlayer', 'BufferRecorder', 'Bus', 'CPUUsageAboveLimitException', 'ChannelArray', 'ChannelCrossfade', 'ChannelMixer', 'ChannelOffset', 'ChannelPanner', 'ChannelSelect', 'Clip', 'ClockDivider', 'CombDelay', 'Compressor', 'Constant', 'Cos', 'Counter', 'CrossCorrelate', 'DCFilter', 'DecibelsToAmplitude', 'DetectSilence', 'DeviceNotFoundException', 'Divide', 'EQ', 'Envelope', 'EnvelopeBuffer', 'Equal', 'Euclidean', 'FFT', 'FFTBuffer', 'FFTBufferPlayer', 'FFTContinuousPhaseVocoder', 'FFTContrast', 'FFTConvolve', 'FFTCrossFade', 'FFTFindPeaks', 'FFTLFO', 'FFTLPF', 'FFTMagnitudePhaseArray', 'FFTNode', 'FFTNoiseGate', 'FFTOpNode', 'FFTPhaseVocoder', 'FFTRandomPhase', 'FFTScaleMagnitudes', 'FFTTonality', 'FFTTransform', 'FeedbackBufferReader', 'FeedbackBufferWriter', 'FlipFlop', 'Fold', 'FrequencyToMidiNote', 'Gate', 'Granulator', 'GraphAlreadyCreatedException', 'GraphNotCreatedException', 'GreaterThan', 'GreaterThanOrEqual', 'HistoryBufferWriter', 'IFFT', 'If', 'Impulse', 'ImpulseSequence', 'Index', 'InsufficientBufferSizeException', 'InvalidChannelCountException', 'KDTree', 'KDTreeMatch', 'LFO', 'Latch', 'LessThan', 'LessThanOrEqual', 'Line', 'Logistic', 'Maximiser', 'MidiNoteToFrequency', 'Modulo', 'MoogVCF', 'MouseDown', 'MouseX', 'MouseY', 'Multiply', 'NearestNeighbour', 'Node', 'NodeAlreadyPlayingException', 'NodeNotPlayingException', 'NodeRegistry', 'NotEqual', 'OneTapDelay', 'OnsetDetector', 'Patch', 'PatchFinishedPlaybackException', 'PatchRegistry', 'PatchSpec', 'PinkNoise', 'Pow', 'RMS', 'RandomBrownian', 'RandomChoice', 'RandomCoin', 'RandomExponential', 'RandomExponentialDist', 'RandomGaussian', 'RandomImpulse', 'RandomImpulseSequence', 'RandomUniform', 'RectangularEnvelope', 'Resample', 'Round', 'RoundToScale', 'SIGNALFLOW_DEFAULT_BLOCK_SIZE', 'SIGNALFLOW_DEFAULT_FFT_HOP_SIZE', 'SIGNALFLOW_DEFAULT_FFT_SIZE', 'SIGNALFLOW_DEFAULT_SAMPLE_RATE', 'SIGNALFLOW_DEFAULT_TRIGGER', 'SIGNALFLOW_EVENT_DISTRIBUTION_POISSON', 'SIGNALFLOW_EVENT_DISTRIBUTION_UNIFORM', 'SIGNALFLOW_FILTER_TYPE_BAND_PASS', 'SIGNALFLOW_FILTER_TYPE_HIGH_PASS', 'SIGNALFLOW_FILTER_TYPE_HIGH_SHELF', 'SIGNALFLOW_FILTER_TYPE_LOW_PASS', 'SIGNALFLOW_FILTER_TYPE_LOW_SHELF', 'SIGNALFLOW_FILTER_TYPE_NOTCH', 'SIGNALFLOW_FILTER_TYPE_PEAK', 'SIGNALFLOW_INTERPOLATION_MODE_COSINE', 'SIGNALFLOW_INTERPOLATION_MODE_LINEAR', 'SIGNALFLOW_INTERPOLATION_MODE_NONE', 'SIGNALFLOW_MAX_CHANNELS', 'SIGNALFLOW_MAX_FFT_SIZE', 'SIGNALFLOW_NODE_BUFFER_SIZE', 'SIGNALFLOW_NODE_INITIAL_OUTPUT_CHANNELS', 'SIGNALFLOW_NODE_STATE_ACTIVE', 'SIGNALFLOW_NODE_STATE_STOPPED', 'SIGNALFLOW_PATCH_STATE_ACTIVE', 'SIGNALFLOW_PATCH_STATE_STOPPED', 'SVFilter', 'SampleAndHold', 'SawLFO', 'SawOscillator', 'ScaleLinExp', 'ScaleLinLin', 'SegmentPlayer', 'SegmentedGranulator', 'SelectInput', 'Sequence', 'Sin', 'SineLFO', 'SineOscillator', 'Smooth', 'SpatialEnvironment', 'SpatialPanner', 'SpatialSpeaker', 'SquareLFO', 'SquareOscillator', 'Squiz', 'StereoBalance', 'StereoPanner', 'StereoWidth', 'StochasticNode', 'Stutter', 'Subtract', 'Sum', 'Tan', 'Tanh', 'TimeShift', 'TriangleLFO', 'TriangleOscillator', 'TriggerMult', 'TriggerRoundRobin', 'UnknownTriggerNameException', 'VampAnalysis', 'WaveShaper', 'WaveShaperBuffer', 'Wavetable', 'Wavetable2D', 'WavetableBuffer', 'WetDry', 'WhiteNoise', 'Wrap', 'amplitude_to_db', 'calculate_decay_coefficient', 'clip', 'db_to_amplitude', 'fold', 'frequency_to_midi_note', 'midi_note_to_frequency', 'random_exponential', 'random_integer', 'random_seed', 'random_uniform', 'save_block_to_text_file', 'save_block_to_wav_file', 'scale_exp_lin', 'scale_lin_exp', 'scale_lin_lin', 'signalflow_event_distribution_t', 'signalflow_filter_type_t', 'signalflow_interpolation_mode_t', 'signalflow_node_state_t', 'signalflow_patch_state_t', 'wrap'] class ADSREnvelope(Node): """ Attack-decay-sustain-release envelope. Sustain portion is held until gate is zero. @@ -67,6 +67,12 @@ class AudioGraph: @typing.overload def __init__(self, config: AudioGraphConfig = None, output_device: str = '', start: bool = True) -> None: ... + @typing.overload + def __init__(self, config_name: str = None, output_device: Node = None, start: bool = True) -> None: + ... + @typing.overload + def __init__(self, config_name: str = None, output_device: str = '', start: bool = True) -> None: + ... def add_node(self, node: Node) -> Node: """ Add `node` to the graph so that it is processed in future blocks, without connecting it to the graph's output. Useful for non-playback nodes (e.g. BufferRecorder). @@ -242,6 +248,7 @@ class AudioGraphConfig: """ Configuration options for the AudioGraph """ + auto_record: bool cpu_usage_limit: float input_buffer_size: int input_device_name: str @@ -478,7 +485,7 @@ class BufferRecorder(Node): ... class Bus(Node): """ - Buss the output of all of the input nodes, by sample. + Bus is a node with a fixed number of input channels and arbitrary number of inputs, used to aggregate multiple sources. It is similar to Sum, but with a defined channel count that does not adapt to its inputs. """ def __init__(self, num_channels: int = 1) -> None: ... @@ -1178,11 +1185,17 @@ class Node: """ Get the node's current output value (equivalent to output_buffer[0][0]) """ + @typing.overload def play(self) -> None: """ Begin playing the node by connecting it to the graph's output """ @typing.overload + def play(self, output_channel: int) -> None: + """ + Begin playing the node by connecting it to the graph's output + """ + @typing.overload def poll(self) -> None: """ Print the node's last output value, once per second @@ -1437,6 +1450,10 @@ class Patch: ... def get_trigger_node(self) -> Node: ... + @typing.overload + def play(self) -> None: + ... + @typing.overload def play(self) -> None: ... def set_auto_free(self, arg0: bool) -> None: @@ -2268,6 +2285,10 @@ def amplitude_to_db(arg0: float) -> float: """ Map linear amplitude to decibels """ +def calculate_decay_coefficient(arg0: float, arg1: int, arg2: float) -> float: + """ + Calculate the coefficient required for an exponential decay curve, with duration of decay_time and final value of decay_level (typically 0.001 or -60dB) + """ def clip(arg0: float, arg1: float, arg2: float) -> float: """ Clip arg0 between [arg1..arg2] diff --git a/docs/library/buffer/historybufferwriter/index.md b/docs/library/buffer/historybufferwriter/index.md new file mode 100644 index 00000000..e8471f3e --- /dev/null +++ b/docs/library/buffer/historybufferwriter/index.md @@ -0,0 +1,13 @@ +title: HistoryBufferWriter node documentation +description: HistoryBufferWriter: Writes a rolling history buffer of a given duration. At a given moment in time, the contents of the buffer will be equal to the past N seconds of the audio generated by `input`. This is useful for (e.g.) a visual display of a rolling waveform or LFO window. `downsample` can be used to downsample the input; for example, with `downsample` of 10, a 1-second buffer can be used to display 10 seconds of historical audio. + +[Reference library](../../index.md) > [Buffer](../index.md) > [HistoryBufferWriter](index.md) + +# HistoryBufferWriter + +```python +HistoryBufferWriter(buffer=None, input=0.0, downsample=1) +``` + +Writes a rolling history buffer of a given duration. At a given moment in time, the contents of the buffer will be equal to the past N seconds of the audio generated by `input`. This is useful for (e.g.) a visual display of a rolling waveform or LFO window. `downsample` can be used to downsample the input; for example, with `downsample` of 10, a 1-second buffer can be used to display 10 seconds of historical audio. + diff --git a/docs/library/envelope/accumulator/index.md b/docs/library/envelope/accumulator/index.md new file mode 100644 index 00000000..d6c68928 --- /dev/null +++ b/docs/library/envelope/accumulator/index.md @@ -0,0 +1,13 @@ +title: Accumulator node documentation +description: Accumulator: Accumulator with decay. + +[Reference library](../../index.md) > [Envelope](../index.md) > [Accumulator](index.md) + +# Accumulator + +```python +Accumulator(strike_force=0.5, decay_coefficient=0.9999, trigger=None) +``` + +Accumulator with decay. + diff --git a/docs/library/operators/bus/index.md b/docs/library/operators/bus/index.md new file mode 100644 index 00000000..ccf0c45b --- /dev/null +++ b/docs/library/operators/bus/index.md @@ -0,0 +1,13 @@ +title: Bus node documentation +description: Bus: Bus is a node with a fixed number of input channels and arbitrary number of inputs, used to aggregate multiple sources. It is similar to Sum, but with a defined channel count that does not adapt to its inputs. + +[Reference library](../../index.md) > [Operators](../index.md) > [Bus](index.md) + +# Bus + +```python +Bus(num_channels=1) +``` + +Bus is a node with a fixed number of input channels and arbitrary number of inputs, used to aggregate multiple sources. It is similar to Sum, but with a defined channel count that does not adapt to its inputs. + diff --git a/docs/library/operators/channeloffset/index.md b/docs/library/operators/channeloffset/index.md new file mode 100644 index 00000000..503abff5 --- /dev/null +++ b/docs/library/operators/channeloffset/index.md @@ -0,0 +1,13 @@ +title: ChannelOffset node documentation +description: ChannelOffset: Offsets the input by a specified number of channels. With an N-channel input and an offset of M, the output will have M+N channels. + +[Reference library](../../index.md) > [Operators](../index.md) > [ChannelOffset](index.md) + +# ChannelOffset + +```python +ChannelOffset(offset=0, input=None) +``` + +Offsets the input by a specified number of channels. With an N-channel input and an offset of M, the output will have M+N channels. + diff --git a/docs/library/operators/selectinput/index.md b/docs/library/operators/selectinput/index.md new file mode 100644 index 00000000..ecc4fbc4 --- /dev/null +++ b/docs/library/operators/selectinput/index.md @@ -0,0 +1,13 @@ +title: SelectInput node documentation +description: SelectInput: Pass through the output of one or more `inputs`, based on the integer input index specified in `index`. Unlike `ChannelSelect`, inputs may be multichannel, and `index` can be modulated in real time. + +[Reference library](../../index.md) > [Operators](../index.md) > [SelectInput](index.md) + +# SelectInput + +```python +SelectInput(index=0) +``` + +Pass through the output of one or more `inputs`, based on the integer input index specified in `index`. Unlike `ChannelSelect`, inputs may be multichannel, and `index` can be modulated in real time. + diff --git a/docs/library/sequencing/triggermult/index.md b/docs/library/sequencing/triggermult/index.md new file mode 100644 index 00000000..610e7b4c --- /dev/null +++ b/docs/library/sequencing/triggermult/index.md @@ -0,0 +1,13 @@ +title: TriggerMult node documentation +description: TriggerMult: Distribute any triggers to all output nodes. + +[Reference library](../../index.md) > [Sequencing](../index.md) > [TriggerMult](index.md) + +# TriggerMult + +```python +TriggerMult(a=0) +``` + +Distribute any triggers to all output nodes. + diff --git a/docs/library/sequencing/triggerroundrobin/index.md b/docs/library/sequencing/triggerroundrobin/index.md new file mode 100644 index 00000000..fded60b2 --- /dev/null +++ b/docs/library/sequencing/triggerroundrobin/index.md @@ -0,0 +1,13 @@ +title: TriggerRoundRobin node documentation +description: TriggerRoundRobin: Relay trigger() events to a single node from the list of connected outputs, with `direction` determining the direction: 1 (or above) = move forwards by N, -1 = move backwards by N, 0 = stationary. + +[Reference library](../../index.md) > [Sequencing](../index.md) > [TriggerRoundRobin](index.md) + +# TriggerRoundRobin + +```python +TriggerRoundRobin(direction=1) +``` + +Relay trigger() events to a single node from the list of connected outputs, with `direction` determining the direction: 1 (or above) = move forwards by N, -1 = move backwards by N, 0 = stationary. +