Skip to content

vkahl/wavefile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wavefile

Build Status Crates.io Status License

Overview

Wavefile is a simple crate for parsing WAV files. It should theoretically handle any of the following:

  • PCM data (most common)
  • IEEE Float
  • Extensible WAV files with PCM/IEEE Float data.

This is a fork. I just changed one detail:
All samples are getting converted/scaled to f32. This way 0dBFS will be represented by -1 or +1 regardless of the sample format.

Basic Example

let wav = match WaveFile::open("/home/john/test.wav") {
  Ok(w)  => w,
  Err(e) => println!("Oh no: {}", e)
};

println!("{} Hz, {} channel(s), {} total samples", w.sample_rate(), w.channels(), w.len());

for frame in w.iter() {
  // Here frame is a Vec<f32> containing one value per channel in the file.
  // Integer samples are scaled down to a range between -1 and 1.
  println!("{:?}", frame);
}

About

Rust wavefile parser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%