skode/pattern

Sequencer pattern settings and step programming for Pulp’s pattern engine.

Mirrors parts/seq.h and the pattern opcode family (y, %, z, zq, zmu, x).

Types

pub type Pattern {
  Pattern(
    id: Int,
    speed: Int,
    length: Int,
    mute: Bool,
    control_events: Bool,
    state: PatternState,
    steps: dict.Dict(Int, String),
  )
}

Constructors

  • Pattern(
      id: Int,
      speed: Int,
      length: Int,
      mute: Bool,
      control_events: Bool,
      state: PatternState,
      steps: dict.Dict(Int, String),
    )
pub type PatternState {
  PatternStopped
  PatternRunning
  PatternPaused
}

Constructors

  • PatternStopped
  • PatternRunning
  • PatternPaused
pub type Step {
  Step(index: Int, code: String)
}

Constructors

  • Step(index: Int, code: String)

Values

pub fn clear_step(pattern: Pattern, step_index: Int) -> Pattern

Remove a step’s program.

pub fn default(pattern_id: Int) -> Pattern

Create an empty default pattern at the given pattern ID (16 steps, speed 1).

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

Compute delta Skode commands when a pattern’s parameters change.

pub fn set_step(
  pattern: Pattern,
  step_index: Int,
  code: String,
) -> Pattern

Set a specific step’s Skode command body (e.g. [v0 n60 l1] x0).

pub fn to_skode(pattern: Pattern) -> String

Serialize a pattern’s settings and all defined steps into Skode script.

✨ Search Document