Struct wavv::Wave [−][src]
Expand description
Struct representing a .wav file
Fields
header: Header
Contains data from the fmt chunk / header part of the file
data: Samples
Contains audio data as samples of a fixed bit depth
metadata: Option<Vec<Chunk>>
Contains metadata
Implementations
Create new Wave
instance from a slice of bytes
Examples
use std::fs; use std::path::Path; use wavv::Wave; fn main() { let bytes = fs::read(Path::new("./test_files/sine_mono_16_44100.wav")).unwrap(); let wave = Wave::from_bytes(&bytes).unwrap(); assert_eq!(wave.header.num_channels, 1); assert_eq!(wave.header.bit_depth, 16); assert_eq!(wave.header.sample_rate, 44_100); }