#audio #file #file-format #file-io

wav

This is a crate for reading in and writing out wave files. It supports bit depths of 8, 16, 24 bits, and 32-bit IEEE Float, and any number of channels.

9 releases (1 stable)

1.0.0 May 15, 2021
0.6.0 Mar 5, 2021
0.5.0 Dec 20, 2020
0.4.1 Oct 10, 2020
0.3.0 Mar 14, 2020

#44 in Audio

Download history 188/week @ 2021-09-27 373/week @ 2021-10-04 241/week @ 2021-10-11 122/week @ 2021-10-18 254/week @ 2021-10-25 277/week @ 2021-11-01 187/week @ 2021-11-08 244/week @ 2021-11-15 390/week @ 2021-11-22 219/week @ 2021-11-29 153/week @ 2021-12-06 240/week @ 2021-12-13 127/week @ 2021-12-20 71/week @ 2021-12-27 115/week @ 2022-01-03 163/week @ 2022-01-10

489 downloads per month
Used in 14 crates (11 directly)

LGPL-3.0

545KB
546 lines

WAV

This is a crate for reading in and writing out wave files. It supports uncompressed PCM bit depths of 8, 16, 24 bits, and 32bit IEEE Float formats, both with any number of channels. Unfortunately other types of data format (e.g. compressed WAVE files) are not supported. There is also no support for any metadata chunks or any chunks other than the "fmt " and "data" chunks.

Example

use std::fs::File;
use std::path::Path;

let mut inp_file = File::open(Path::new("data/sine.wav"))?;
let (header, data) = wav::read(&mut inp_file)?;

let mut out_file = File::create(Path::new("data/output.wav"))?;
wav::write(header, &data, &mut out_file)?;

lib.rs:

This is a crate for reading in and writing out wave files. It supports uncompressed PCM bit depths of 8, 16, 24 bits, and 32bit IEEE Float formats, both with any number of channels. Unfortunately other types of data format (e.g. compressed WAVE files) are not supported. There is also no support for any metadata chunks or any chunks other than the "fmt " and "data" chunks.

Example

# fn main() -> std::io::Result<()> {
use std::fs::File;
use std::path::Path;

let mut inp_file = File::open(Path::new("data/sine.wav"))?;
let (header, data) = wav::read(&mut inp_file)?;

let mut out_file = File::create(Path::new("data/output.wav"))?;
wav::write(header, &data, &mut out_file)?;
# Ok(())
# }

Dependencies