prime-render 1.1.1

Pure sample-level scan loop — fold a pure step function over N audio samples
Documentation
  • Coverage
  • 100%
    4 out of 4 items documented3 out of 3 items with examples
  • Size
  • Source code size: 15.08 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.3 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 12s Average build duration of successful builds.
  • all releases: 12s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • bwyard/prime
    1 0 3
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • bwyard

prime-render

Pure sample-level audio scan loop — fold a stateless step function over N audio samples. The proof that a song is a pure function of time.

Part of the prime math ecosystem.

What's inside

  • render — fold a mono step function over a sample buffer
  • render_stereo — fold a stereo step function over an interleaved buffer
  • render_fold — fold with an accumulator (collect events, gather analysis data)

Usage

use prime_render::render;

// Step function: (state, sample_index) -> (sample, next_state)
let step = |state: MyState, i: usize| -> (f32, MyState) {
    let phase = state.phase + state.freq / sample_rate;
    let sample = (phase * std::f32::consts::TAU).sin();
    (sample, MyState { phase, ..state })
};

let buffer = render(initial_state, num_samples, step);

Design

No audio thread, no callbacks, no mutation. The render loop is a pure fold — same initial state always produces the same buffer. Useful for offline rendering, testing, and proving that audio synthesis is deterministic.

License

MIT