Skip to main content

Module precompute

Module precompute 

Source
Expand description

Precomputed scattering matrix binary format (.pksc).

Stores scattering matrices, VS injection vectors, port resistances, and pot interpolation tables so Cortex-M7 can skip MNA derivation at runtime.

§Binary format

All multi-byte values are little-endian. f64 values are transmitted as their IEEE-754 bit pattern.

Header (32 bytes):
  magic:              [u8; 4]  = b"PKSC"
  version:            u16      = 1
  flags:              u16      = 0
  pedal_hash:         u32      (FNV-1a of source text)
  sample_rate_bits:   u64      (f64::to_bits)
  num_stages:         u16
  num_interp_tables:  u16
  reserved:           [u8; 8]

Per Stage:
  stage_type:        u8     (0=WDF, 1=MultiNL, 2=PushPull)
  n_ports:           u16
  has_vs_injection:  u8
  has_extract:       u8
  padding:           [u8; 3]
  scattering:        [f64; n_ports × n_ports]  row-major
  vs_injection:      [f64; n_ports]             only if has_vs_injection != 0
  port_resistances:  [f64; n_ports]
  extract_coeffs:    [f64; n_ports]             only if has_extract != 0
  extract_vs:        f64                        only if has_extract != 0

Per Interpolation Table:
  stage_index:       u16
  n_positions:       u16
  n_ports:           u16
  has_vs_injection:  u8
  padding:           u8
  resistances:       [f64; n_positions]
  matrices:          [f64; n_positions × n_ports × n_ports]
  injections:        [f64; n_positions × n_ports]   only if has_vs_injection != 0

Structs§

PrecomputedInterpTable
Precomputed pot-sweep interpolation table for a single-pot stage.
PrecomputedScattering
A complete precomputed scattering package for one .pedal file.
PrecomputedStage
Precomputed data for one stage (WDF, MultiNL, or PushPull).

Enums§

PrecomputeError
Errors produced by .pksc serialization / deserialization.

Functions§

extract_precomputed
Extract a PrecomputedScattering from a compiled pedal.
pedal_hash
Compute the 32-bit FNV-1a hash of text.