riff-wave-reader 0.1.0

Reads riff-wave compliant files. Get header info and access to the underlying reader positioned on the data block.
Documentation
  • Coverage
  • 0%
    0 out of 64 items documented0 out of 13 items with examples
  • Size
  • Source code size: 16.55 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 3.6 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tarkah/riff-wave-reader
    1 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tarkah

Riff Wave Reader

Reads riff-wave compliant files. Get header info and access to the underlying reader positioned on the data block.

Using RiffWaveReader

use anyhow::Error;

use std::fs::File;
use std::io::BufReader;

use riff_wave_reader::RiffWaveReader;

fn main() -> Result<(), Error> {
    let file = File::open("path/to/file.wav")?;

    let reader = BufReader::new(file);
    let mut reader = RiffWaveReader::new(reader)?;

    // Print header info
    reader.print_info();

    // Option 1, iterate over all data bytes
    let data = reader.data()?.collect::<Vec<u8>>();

    // Option 2, get the underlying reader, positioned at the start of the
    // data block
    let reader = reader.into_reader();

    // Do stuff with data / reader...

    Ok(())
}

Print header info from CLI

cargo run -- print path/to/file.wav

------ Header ------
Size:            651016
Format:          ExtendedWave
Channels:        2
Sample Rate:     44100
Byte Rate:       8096
Block Align:     376
Bits per Sample: 0
Extra Info:      34
----- Extended -----
Sample Info:     2048
Channel Mask:    0b0000000000000011
Sub Format:      62cee401faff19a14471cb58e923aabf
Remaining Data:  [1, 0, 40, 46, 0, 0, 0, 0, 0, 0, 0, 0]
------- Fact -------
Fact Length:     12
Sample Length:   3541379
Remaining Data:  [214, 9, 0, 0, 142, 10, 0, 0]
--- Other Chunks ---
Chunk Ids:       ["smpl"]
------- Data -------
Data Length:     650856
Padding Byte:    0