#wav #no-std

no-std wavv

no_std library for reading wav files

5 releases

0.1.4 Jul 30, 2021
0.1.3 Mar 31, 2021
0.1.2 Mar 28, 2021
0.1.1 Mar 27, 2021
0.1.0 Mar 27, 2021

#912 in Audio

35 downloads per month

Apache-2.0

20KB
340 lines

wavv

.github/workflows/main.yml Crates.io docs.rs

Very basic #![no_std] library for reading wav files.

NOTE! this library is unfinished, incomplete and still contains bugs!

use std::fs;
use std::path::Path;
use wavv::{Wave, Samples};

fn main() {
    let bytes = fs::read(Path::new("foo.wav")).unwrap();
	let wave = Wave::from_bytes(&bytes).unwrap();

    println!(
        "sample rate: {}, channels: {}, bit depth: {}",
        wave.format.sample_rate, wave.format.bit_depth, wave.format.num_channels
    );

    match wave.data {
        Samples::BitDepth8(samples) => println!("{:?}", samples),
        Samples::BitDepth16(samples) => println!("{:?}", samples),
        Samples::BitDepth24(samples) => println!("{:?}", samples),
    }
}

No runtime deps