skode/delay

Delay bus domain model and Skode serialization for Pulp’s 4 delay lines.

Mirrors delay_bus_t in parts/synth-internal.h and the opcode handlers in parts/synth-delay.c.

Types

pub type DelayBus {
  DelayBus(
    id: Int,
    coarse: Int,
    fine: Int,
    feedback: Int,
    mod_freq: Int,
    mod_depth: Int,
    level: Int,
    damping: Int,
    highpass: Int,
    pingpong: Bool,
    freeze: Bool,
    grit: DelayGrit,
    sync: option.Option(#(Float, Float)),
  )
}

Constructors

  • DelayBus(
      id: Int,
      coarse: Int,
      fine: Int,
      feedback: Int,
      mod_freq: Int,
      mod_depth: Int,
      level: Int,
      damping: Int,
      highpass: Int,
      pingpong: Bool,
      freeze: Bool,
      grit: DelayGrit,
      sync: option.Option(#(Float, Float)),
    )
pub type DelayGrit {
  NativeFloat
  Quantized(bits: Int)
}

Constructors

  • NativeFloat

    Full 32-bit floating point precision (no bit reduction)

  • Quantized(bits: Int)

    Quantized bit depth (1..16 bits, default is 12-bit)

Values

pub fn default(bus_id: Int) -> DelayBus

Create a default delay bus configuration.

pub fn delay_time_ms(coarse: Int, fine: Int) -> Float

Calculate base delay time in milliseconds from coarse and fine parameters. Formula from parts/synth-delay.c: base_ms = 8.0 * (1 << coarse) * (0.5 + (fine / 15.0) * 0.5)

pub fn diff_skode(old: DelayBus, new: DelayBus) -> List(String)

Compute minimal delta Skode commands when a DelayBus changes. Ideal for real-time Lustre UI slider tweaking.

pub fn feedback_gain(feedback: Int) -> Float

Calculate feedback linear gain from the feedback parameter (0..15). Formula: (feedback / 15.0) * 0.82

pub fn mod_lfo_hz(mod_freq: Int) -> Float

Calculate modulation LFO rate in Hz from mod_freq (0..31). Formula: (mod_freq / 31.0) * 10.0 Hz

pub fn to_skode(bus: DelayBus) -> String

Serialize a DelayBus into full canonical Skode script.

✨ Search Document