skode/param

Parameter metadata, bounds checking, and physical unit conversions for the Pulp / Skred audio synthesizer engine.

All values correspond directly to the constraints in the C engine (parts/synth-state.h, synth-types.h, and synth-delay.c).

Types

pub type Adsr {
  Adsr(
    attack: Float,
    decay: Float,
    sustain: Float,
    release: Float,
  )
}

Constructors

  • Adsr(attack: Float, decay: Float, sustain: Float, release: Float)
pub type FilterMode {
  FilterOff
  LowPass
  BandPass
  HighPass
  Notch
  AllPass
}

Constructors

  • FilterOff
  • LowPass
  • BandPass
  • HighPass
  • Notch
  • AllPass
pub type Pitch {
  Freq(hz: Float)
  Note(midi: Float, cents: Float)
}

Constructors

  • Freq(hz: Float)
  • Note(midi: Float, cents: Float)
pub type WaveDirection {
  Forward
  Backward
  PingPong
}

Constructors

  • Forward
  • Backward
  • PingPong

Values

pub const center_pan: Float
pub fn clamp_adsr(adsr: Adsr) -> Adsr
pub fn clamp_bpm(bpm: Float) -> Float
pub fn clamp_cents(c: Float) -> Float

Clamp cents detune to -100.0 .. +100.0.

pub fn clamp_db(db: Float) -> Float

Clamp decibels to engine operating range (-60 dB .. +12 dB).

pub fn clamp_delay_bus_id(id: Int) -> Int
pub fn clamp_frequency(hz: Float) -> Float

Clamp frequency to the engine’s audible range (20 Hz - 20,000 Hz).

pub fn clamp_midi_note(note: Float) -> Float

Clamp MIDI note to standard 0.0 .. 127.0 range.

pub fn clamp_pan(p: Float) -> Float

Clamp stereo pan to -1.0 (hard left) .. +1.0 (hard right).

pub fn clamp_pattern_id(id: Int) -> Int
pub fn clamp_resonance(q: Float) -> Float

Clamp filter resonance Q factor (0.1 .. 20.0).

pub fn clamp_step_id(id: Int) -> Int
pub fn clamp_voice_id(id: Int) -> Int
pub fn db_to_linear(db: Float) -> Float

Convert decibels (dB) to linear amplitude multiplier (0.0 .. ~4.0). Formula: 10^(db / 20)

pub fn default_adsr() -> Adsr
pub const default_bpm: Float
pub const default_frequency_hz: Float
pub const default_master_volume_db: Float
pub const default_midi_note: Float
pub const default_resonance_q: Float
pub const default_subdivision: Float
pub const default_voice_db: Float
pub const delay_bus_count: Int
pub fn filter_mode_from_int(i: Int) -> FilterMode
pub fn filter_mode_to_int(m: FilterMode) -> Int
pub fn format_float(f: Float) -> String

Format a float cleanly: whole numbers without decimal point, otherwise standard float string.

pub fn linear_to_db(linear: Float) -> Float

Convert linear amplitude multiplier (> 0.0) to decibels (dB). Formula: 20 * log10(lin)

pub const max_bpm: Float
pub const max_cents: Float
pub const max_db: Float
pub const max_frequency_hz: Float
pub const max_midi_note: Float
pub const max_pan: Float
pub const max_patterns: Int
pub const max_resonance_q: Float
pub const max_steps: Int
pub const max_voices: Int
pub const max_wave_index: Int
pub fn midi_to_hz(note: Float, cents: Float) -> Float

Convert a MIDI note number (with cents offset) to Frequency in Hz (A4 = 440Hz = MIDI 69).

pub const min_bpm: Float
pub const min_cents: Float
pub const min_db: Float
pub const min_frequency_hz: Float
pub const min_midi_note: Float
pub const min_pan: Float
pub const min_resonance_q: Float
pub const min_wave_index: Int
pub const silent_db: Float
pub fn wave_direction_from_int(i: Int) -> WaveDirection
pub fn wave_direction_to_int(d: WaveDirection) -> Int
✨ Search Document