Crates.io Crates.io GitHub last commit GitHub Workflow Status

bwavfile

Rust Wave File Reader/Writer with Broadcast-WAV, MBWF and RF64 Support

Features

This is currently a work-in-progress! However many features presently work:

Use Examples

Reading Audio Frames From a File

```rust

use bwavfile::WaveReader; let mut r = WaveReader::open("tests/media/ff_silence.wav").unwrap();

let format = r.format().unwrap(); asserteq!(format.samplerate, 44100); asserteq!(format.channelcount, 1);

let mut framereader = r.audioframereader().unwrap(); let mut buffer = framereader.createframebuffer();

let read = framereader.readinteger_frame(&mut buffer).unwrap();

asserteq!(buffer, [0i32]); asserteq!(read, 1); ```

Accessing Channel Descriptions

```rust use bwavfile::{WaveReader, ChannelMask};

let mut f = WaveReader::open("tests/media/pt24bit51.wav").unwrap();

let chans = f.channels().unwrap(); asserteq!(chans[0].index, 0); asserteq!(chans[0].speaker, ChannelMask::FrontLeft); asserteq!(chans[3].index, 3); asserteq!(chans[3].speaker, ChannelMask::LowFrequency); assert_eq!(chans[4].speaker, ChannelMask::BackLeft); ```

Note on Testing

All of the media for the integration tests is committed to the respository in zipped form. Before you can run tests, you need to cd into the tests directory and run the create_test_media.sh script. Note that one of the test files (the RF64 test case) is over four gigs in size.