#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, and 24 bits, and any number of channels.

6 releases (3 breaking)

new 0.4.1 Oct 10, 2020
0.4.0 May 23, 2020
0.3.0 Mar 14, 2020
0.2.0 Mar 12, 2020
0.1.1 Jan 19, 2020

#64 in Audio

Download history 5/week @ 2020-06-25 14/week @ 2020-07-02 12/week @ 2020-07-09 1/week @ 2020-07-16 11/week @ 2020-07-23 12/week @ 2020-07-30 21/week @ 2020-08-06 6/week @ 2020-08-13 16/week @ 2020-08-20 14/week @ 2020-08-27 30/week @ 2020-09-03 11/week @ 2020-09-10 14/week @ 2020-09-17 14/week @ 2020-09-24 18/week @ 2020-10-01 41/week @ 2020-10-08

62 downloads per month
Used in 5 crates

LGPL-3.0

15KB
259 lines

WAV

This is a crate for reading in and writing out wave files. It supports bit depths of 8, 16, and 24 bits, any number of channels, and uncompressed PCM data. 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:

WAV

This is a crate for reading in and writing out wave files. It supports bit depths of 8, 16, and 24 bits, any number of channels, and uncompressed PCM data. Unfortunately other types of data format (e.g. compressed WAVE files) are not supported.

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

~120KB