Struct wavv::Wave[][src]

pub struct Wave {
    pub header: Header,
    pub data: Samples,
    pub metadata: Option<Vec<Chunk>>,
}
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);
}

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.