Skip to main content

Crate trem

Crate trem 

Source
Expand description

§trem — mathematical music engine

Core library for exact-arithmetic music composition and audio processing. No I/O dependencies — this crate compiles to WASM and renders offline.

§Key modules

  • math — Exact rational arithmetic (Rational = p/q in lowest terms)
  • pitch — Pitch representation, scales, and tuning systems (EDO, just intonation, free)
  • time — Beat-accurate durations and time spans
  • event — Note events (scale degree + octave + velocity) and graph events (frequency + voice)
  • tree — Recursive temporal trees for rhythmic subdivision (Seq, Par, Weight)
  • grid — 2D step sequencer grid (rows = steps, columns = voices)
  • graph — Audio processing DAG with typed processor nodes
  • dsp — Built-in processors: oscillators, envelopes, filters, distortion, effects, drum synths, plus composite voices dsp::analog_voice and dsp::lead_voice
  • euclidean — Euclidean rhythm generation (Toussaint 2005)
  • render — Offline rendering of trees/grids through audio graphs

Modules§

dsp
Audio DSP processors for the Trem graph: oscillators, envelopes, dynamics, mixing, filters, noise, drum voices, time-based effects, EQ, and composable graph voices.
euclidean
Evenly spaced onsets (Euclidean rhythms) and cyclic pattern rotation.
event
Composition-layer note data and runtime graph events with sample timing.
graph
Audio graph: Processor nodes, routing, block processing, and parameter introspection.
grid
Row/column pattern editor backed by a flat cell vec and Tree conversion.
math
Exact arithmetic for time and rhythm backed by num_rational::Rational64.
pitch
Pitch representation, scales, and tuning systems.
registry
Processor registry: create processors by short tag at runtime.
render
Turn Trees and Grids into TimedEvents and offline multi-block Graph renders.
time
Beat-based durations and half-open time spans using exact Rational math.
tree
Hierarchical rhythm trees: sequential splits, parallel layers, and weighted subdivisions.