#audio #broadcast #multimedia #smpte

bwavfile

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

1 unstable release

0.9.3 Jan 5, 2021
0.9.2 Jan 1, 2021
0.9.1 Dec 27, 2020
0.1.7 Dec 11, 2020
0.1.5 Nov 28, 2020

#71 in Audio

Download history 13/week @ 2021-02-27 24/week @ 2021-03-20 12/week @ 2021-03-27 12/week @ 2021-04-03 26/week @ 2021-04-10 2/week @ 2021-04-17 16/week @ 2021-04-24 1/week @ 2021-05-08 13/week @ 2021-05-15 13/week @ 2021-06-05

51 downloads per month

MIT license

150KB
1.5K SLoC

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:

Feature Read Write
Standard .wav files ☑️ ☑️
Transparent promotion to RF64/BW64 ☑️ ☑️
Unified interface for regular and extended Wave format ☑️ ☑️
Channel/speaker map metadata ☑️ ☑️
Ambisonic B-format metadata ☑️ ☑️
EBU Broadcast-WAVE metadata ☑️ ☑️
Basic iXML/ADM metadata ☑️ ☑️
Enhanced iXML metadata support
ADM chna channel metadata
Broadcast-WAVE Level overview levl metadata
Cue list metadata ☑️
Sampler and instrument metadata
Enhanced Wave file form validation ☑️

Use Examples

Examples Directory

Check out the examples directory for some practical use cases:

  • blits shows how to use WaveWriter to create a new file with BLITS alignment tones.

Reading Audio Frames From a File


 use bwavfile::WaveReader;
 let mut r = WaveReader::open("tests/media/ff_silence.wav").unwrap();
 
 let format = r.format().unwrap();
 assert_eq!(format.sample_rate, 44100);
 assert_eq!(format.channel_count, 1);
 
 let mut buffer = format.create_frame_buffer();
 let mut frame_reader = r.audio_frame_reader().unwrap();
 
 let read = frame_reader.read_integer_frame(&mut buffer).unwrap();
 
 assert_eq!(buffer, [0i32]);
 assert_eq!(read, 1);

Accessing Channel Descriptions

 use bwavfile::{WaveReader, ChannelMask};
 
 let mut f = WaveReader::open("tests/media/pt_24bit_51.wav").unwrap();
    
 let chans = f.channels().unwrap();
 assert_eq!(chans[0].index, 0);
 assert_eq!(chans[0].speaker, ChannelMask::FrontLeft);
 assert_eq!(chans[3].index, 3);
 assert_eq!(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.

Dependencies

~3MB
~46K SLoC