Audio effects
Register an audio effect with register_audio_effect():
from editor.plugin_api import PluginParameterDefinition
def process(samples, sample_rate, parameters, context):
gain = float(parameters["gain"])
return samples * gain
def register(api):
api.register_audio_effect(
effect_id="gain",
name="Gain",
processor=process,
parameters=(
PluginParameterDefinition(
key="gain",
label="Gain",
control="slider",
default=1.0,
minimum=0.0,
maximum=2.0,
step=0.01,
),
),
)Caution: Preserve the expected frame/channel shape and return finite sample data. Audio processors run on bounded chunks during playback and render.
Audio processor contract
def process(samples, sample_rate, parameters, context):
...samples is normalized float32 audio with shape:
(frames, channels)
Values normally fall in [-1.0, 1.0]. Return an array with the same shape.
Yrendr converts the result to float32 and clamps it to [-1.0, 1.0] after each
plugin.
An exception or invalid shape causes that processor result to be skipped.
sample_rate is the integer sample rate of the current PCM buffer.
Preview processing may operate on bounded chunks rather than an entire source file. Do not assume a processor call starts at the beginning of the media.
Audio context
Track preview processing includes values such as:
{
"clip": clip,
"project": project,
"track": 1,
"playhead": 5.2,
"preview": True,
}Master audio processing is executed after the complete timeline mix and receives
clip=None, track=None and scope="master".
Stateful DSP should be designed carefully because preview seeks and export chunk boundaries may differ. Prefer algorithms that can tolerate discontinuities or keep state explicitly keyed to a stable processing context.
Custom editor support
register_audio_effect() accepts custom_editor= and window_options= in addition to native parameter definitions. This is useful for meters, graph-based DSP controls or image-driven audio interfaces. Declared parameters remain the persisted contract and the custom editor returns the updated parameter dictionary.
When Yrendr supplies waveform_provider, the custom-editor callback may use it for audio-specific visualization. See Custom editors and plugin windows for the full editor/window contract.