#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

#123 in Audio

Download history 10207/week @ 2023-10-20 10873/week @ 2023-10-27 9262/week @ 2023-11-03 7025/week @ 2023-11-10 5784/week @ 2023-11-17 5350/week @ 2023-11-24 6607/week @ 2023-12-01 7033/week @ 2023-12-08 6362/week @ 2023-12-15 3443/week @ 2023-12-22 4625/week @ 2023-12-29 6996/week @ 2024-01-05 6964/week @ 2024-01-12 7128/week @ 2024-01-19 6076/week @ 2024-01-26 5029/week @ 2024-02-02

26,683 downloads per month
Used in 46 crates (27 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

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)?;

Dependencies