17.1. Event payload and ADSR/delay-time resolvers

Module strudel_event

17.1.1. Structures

Event
Fields:
  • s : string = “” - Sound/sample name (“bd”, “sd”, “sawtooth”, “sine”, …).

  • note : float = 60f - MIDI note number (60 = middle C).

  • n : int = 0 - Sample variation index within a bank (bd:0, bd:1, bd:2).

  • gain : float = 0.8f - Amplitude 0.0–1.0, applied after rendering.

  • velocity : float = 1f - Expression 0.0–1.0; scales gain and may affect timbre.

  • pan : float = 0.5f - Stereo pan: 0.0 = left, 0.5 = center, 1.0 = right.

  • speed : float = 1f - Sample playback speed (1.0 = normal, 2.0 = double, 0.5 = half).

  • lpf : float = 0f - Low-pass filter cutoff in Hz (0 = disabled).

  • lpq : float = 1f - Low-pass filter resonance Q (1.0 = gentle, >5 = peaky).

  • hpf : float = 0f - High-pass filter cutoff in Hz (0 = disabled).

  • hpq : float = 1f - High-pass filter resonance Q (1.0 = gentle, >5 = peaky).

  • attack : float = -1f - Envelope attack time in seconds (-1 = unset, resolver picks default).

  • decay : float = -1f - Envelope decay time in seconds (-1 = unset).

  • sustain : float = -1f - Envelope sustain level 0.0–1.0 (-1 = unset).

  • release : float = -1f - Envelope release time in seconds (-1 = unset).

  • cut : int = 0 - Cut group (0 = no cut, >0 = kill any voice with the same cut id).

  • room : float = 0f - Reverb send amount 0.0–1.0.

  • roomsize : float = 2f - Reverb decay time in seconds (0.1–10.0).

  • delay_amount : float = 0f - Delay send amount 0.0–1.0.

  • delaytime : float = -1f - Delay time in seconds (-1 = unset, derived from delaysync and cps).

  • delayfeedback : float = 0.5f - Delay feedback 0.0–1.0.

  • delaysync : float = 0.1875f - Delay time in cycles; used when delaytime is unset (default = 3/16 cycle, dotted-eighth feel).

  • orbit : int = 0 - Effect-bus routing id (0 = default bus).

  • fm : float = 0f - FM synthesis modulation depth.

  • fmh : float = 1f - FM harmonicity ratio (modulator frequency / carrier frequency).

  • vowel : string = “” - Vowel formant filter (“a”, “e”, “i”, “o”, “u”, …).

  • chorus : float = 0f - Chorus send amount 0.0–1.0.

  • begin : float = 0f - Sample region start (fraction of sample length, 0.0 = beginning).

  • end_pos : float = 1f - Sample region end (fraction of sample length, 1.0 = end). Named to avoid the end keyword.

  • crush : float = 0f - Bit-depth reduction (0 = off, 4–16 = target bit depth).

  • coarse : int = 0 - Sample-rate reduction factor (0 = off, 2 = half rate).

  • shape : float = 0f - Waveshaper drive (0 = off, >0 = saturated).

  • djf : float = 0.5f - DJ filter (0 = full LPF, 0.5 = bypass, 1 = full HPF).

  • bpf : float = 0f - Bandpass filter cutoff in Hz (0 = disabled).

  • bpq : float = 1f - Bandpass filter resonance Q.

  • phaser : float = 0f - Phaser LFO rate in Hz (0 = off).

  • phaserdepth : float = 0.75f - Phaser depth 0.0–1.0 (controls notch Q and sweep range).

  • phasercenter : float = 1000f - Phaser center frequency in Hz.

  • phasersweep : float = 2000f - Phaser sweep range in Hz.

  • tremolo : float = 0f - Tremolo LFO rate in Hz (0 = off).

  • tremolodepth : float = 1f - Tremolo depth 0.0–1.0.

  • compressor : float = 1f - Compressor threshold in dB (>=0 = bypass; typical -20..-3).

  • compressor_ratio : float = 10f - Compression ratio (>=1).

  • compressor_knee : float = 10f - Compressor soft-knee width in dB.

  • compressor_attack : float = 0.005f - Compressor attack time in seconds.

  • compressor_release : float = 0.05f - Compressor release time in seconds.

  • sf2_program : int = -1 - SF2 GM program number (-1 = not SF2; use sample/oscillator instead).

  • sf2_bank : int = 0 - SF2 bank (0 = melodic, 128 = percussion).

  • sf2_expression : float = -1f - SF2 expression (CC11) 0.0–1.0 (-1 = use default).

  • sf2_mod_wheel : float = -1f - SF2 mod wheel (CC1) 0.0–1.0 (-1 = use default).

  • sf2_pitch_bend : float = -1f - SF2 pitch bend 0.0–1.0 (0.5 = center, -1 = use default).

17.1.2. ADSR and delay resolution

resolve_adsr(attack: float; decay: float; sustain: float; release: float): tuple<float;float;float;float>

Resolve ADSR fields from their “user set / unset” form (-1 = unset) into concrete envelope parameters. Rules: nothing set -> tiny edges + full sustain; only decay set -> percussion (sustain drops to zero); only attack/release set -> held tone; sustain set explicitly -> uses the given value. All values are clamped to floors so a stray 0 never produces a click.

Arguments:
  • attack : float

  • decay : float

  • sustain : float

  • release : float

resolve_delaytime(delaytime: float; delaysync: float; cps: float): float

Resolve delay time: use delaytime if set (>= 0), otherwise derive from delaysync (in cycles) and the current cps so the echo locks to tempo. The 3/16-cycle default yields a dotted-eighth feel that tracks tempo changes.

Arguments:
  • delaytime : float

  • delaysync : float

  • cps : float