#symphonia #sound #sampler #file #mimium

mimium-symphonia

sound file sampler implementation using symphonia for mimium

8 releases (stable)

new 2.2.3 Dec 18, 2024
2.2.2 Dec 16, 2024
2.0.0-alpha2 Nov 18, 2024

#200 in Audio

Download history 205/week @ 2024-11-13 48/week @ 2024-11-20 3/week @ 2024-11-27 489/week @ 2024-12-04 163/week @ 2024-12-11

733 downloads per month
Used in mimium-cli

MPL-2.0 and LGPL-3.0

365KB
9K SLoC

mimium-symphonia

An external function implementation to read audio files in mimium using Symphonia crate.

Example

//gen_sampler_mono returns higher-order function that takes playback position in samples as an argument
let sampler = gen_sampler_mono("test.wav")
fn counter(){
    self+1
}
fn dsp(){
    counter() |> sampler
}

gen_sampler_mono should be called only on global evaluation context.

Current status

  • An argument for gen_sampler_mono is a relative path from the source .mmm, or an absolute path.
  • Currently there's no operation is supported on string type (only the literal is supported) in mimium, parametric file loading can not be realized for now.
  • Supported file format are the same as what symphonia can decode
  • Currently, only mono files are supported (other formats will cause panic on runtime).
  • An index for sampler is a raw position of samples (now, samplerate mismatch between audio driver and audio file are not handled. Resampler is not implemented as a part of symphonia, but there's an example code of resampler in symphonia-play application, it can be derived in the future).
  • An index are not needed to be integer, a boundary check and linear interpolation are performed on read.(Aceess out of range returns 0.0 .)
  • gen_sampler_mono function internally creates external Rust closure that holds Vec as internal data(The allocated external closure will never be released in the current implementation. )

Dependencies

~11–37MB
~619K SLoC