skode/voice

Synth voice domain model, default patch initialization, and Skode serialization.

Represents a single voice (0..255) in Pulp’s voice allocation table (sv). Designed for use in the Lustre Voice Editor and across BEAM languages.

Types

pub type Envelope {
  Envelope(adsr: param.Adsr, mode: Int, velocity: Float)
}

Constructors

  • Envelope(adsr: param.Adsr, mode: Int, velocity: Float)
pub type Filter {
  Filter(
    mode: param.FilterMode,
    character: Int,
    cutoff_hz: Float,
    resonance_q: Float,
    envelope: option.Option(FilterEnvelope),
  )
}

Constructors

pub type FilterEnvelope {
  FilterEnvelope(adsr: param.Adsr, depth: Float)
}

Constructors

pub type FmConfig {
  FmConfig(mod_voice: Int, depth: Float, adder: Float, mode: Int)
}

Constructors

  • FmConfig(mod_voice: Int, depth: Float, adder: Float, mode: Int)
pub type Glissando {
  Glissando(time: Float, mode: Int)
}

Constructors

  • Glissando(time: Float, mode: Int)
pub type Mix {
  Mix(
    amp_db: Float,
    pan: Float,
    mute: Bool,
    record_track: Int,
    delay_send: Float,
  )
}

Constructors

  • Mix(
      amp_db: Float,
      pan: Float,
      mute: Bool,
      record_track: Int,
      delay_send: Float,
    )
pub type Modulation {
  Modulation(
    glissando: option.Option(Glissando),
    smoother: option.Option(Float),
    ring_mod: option.Option(#(Int, Float)),
    freq_mod: option.Option(FmConfig),
    freq_feedback: Float,
    sample_hold: option.Option(SampleHold),
  )
}

Constructors

pub type Oscillator {
  Oscillator(
    wave: Int,
    pitch: param.Pitch,
    detune_cents: Float,
    interpolate: Bool,
    one_shot: Bool,
    direction: param.WaveDirection,
    loop_enabled: Bool,
    loop_count: Int,
    phase_dist: option.Option(PhaseDist),
    sample_window: option.Option(#(Int, Int)),
    wave_loop: option.Option(#(Int, Int)),
  )
}

Constructors

pub type PhaseDist {
  PhaseDist(mode: Int, distortion: Float)
}

Constructors

  • PhaseDist(mode: Int, distortion: Float)
pub type SampleHold {
  SampleHold(ratio: Float, mode: Int)
}

Constructors

  • SampleHold(ratio: Float, mode: Int)
pub type Voice {
  Voice(
    id: Int,
    oscillator: Oscillator,
    envelope: Envelope,
    filter: Filter,
    mix: Mix,
    modulation: Modulation,
    links: VoiceLinks,
  )
}

Constructors

pub type VoiceLinks {
  VoiceLinks(
    gate: List(Int),
    sync: List(Int),
    velocity: List(Int),
  )
}

Constructors

  • VoiceLinks(gate: List(Int), sync: List(Int), velocity: List(Int))

Values

pub fn default(voice_id: Int) -> Voice

Create a clean default voice patch at the given voice ID.

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

Compute minimal delta Skode commands when a voice’s parameters change. This is the reactive driver for the Lustre Voice Editor.

pub fn to_skode(voice: Voice) -> String

Serialize a complete voice patch into canonical Skode commands.

✨ Search Document