| Crates.io | audio_samples_io |
| lib.rs | audio_samples_io |
| version | 0.1.4 |
| created_at | 2025-12-18 19:26:12.053043+00 |
| updated_at | 2025-12-28 20:36:56.542492+00 |
| description | A Rust library for audio input and output operations. |
| homepage | https://jmg049.github.io/audio_samples_io |
| repository | https://github.com/jmg049/audio_samples_io |
| max_upload_size | |
| id | 1993243 |
| size | 1,015,527 |
Rust crate providing audio file I/O utilities and helpers.
audio_samples_io is the IO extension of the audio_samples crate.
audio_samples_io builds on top of the representations provided by audio_samples to provide the functionality necessary for reading, writing and investigating audio files.
Currently only supports .wav files
Install via:
cargo add audio_samples_io
use std::time::Duration;
use audio_samples_io::error::AudioIOResult;
use audio_samples::{AudioSamples, sine_wave};
pub fn main() -> AudioIOResult<()> {
// create and write a basic signal and read it back
let sine_wave: AudioSamples<f32> =
sine_wave::<_, f32>(440.0, Duration::from_secs_f64(10.0), 44100, 1.0);
audio_samples_io::write("./sine_wave.wav", &sine_wave)?;
let read_sine_wave: AudioSamples<f32> = audio_samples_io::read("./sine_wave.wav")?;
println!("{:#}", read_sine_wave);
println!("Duration: {:.1}s", read_sine_wave.duration_seconds::<f32>());
Ok(())
}
Checkout the benchmark summary doc for a comparison against Hound and libsndfile.
To run the benchmarks (Criterion) reading and writing.
cargo bench --bench wav_rw
I have included a small benchmark reported binary for collating benchmarks to a markdown file
cargo run --bin benchmark_reporter --features benchmark_reporting
benchmark_report.md — Markdown summary generated by the reporter binarybenchmark_results.csv — Detailed CSV export of benchmark rows (times in μs)benchmark_summary.csv — Executive summary CSVMIT License
Contributions are welcome. Please submit a pull request and see CONTRIBUTING.md for guidance.