Skip to content
JorgeO3Public

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

32 Commits

Folders and files

Repository files navigation

wave_rush

High-performance WAV (PCM) parser and packet decoder in Rust, with runtime SIMD dispatch and a streaming API.

Why this project

wave_rush is a systems-focused Rust project built to demonstrate:

  • Binary format parsing with strict boundary and overflow checks.
  • Performance-oriented audio decoding with AVX2/SSE4.1/scalar backends.
  • Streamed processing of large files without loading everything into memory.
  • Test coverage for parser behavior, decoder equivalence, and fuzz-style random inputs.

Features

  • Parses RIFF/WAVE headers and chunks (fmt , data, LIST/INFO, fact).
  • Decodes PCM samples to i32 packets via FallibleStreamingIterator.
  • Supports PCM bit depths: 8, 16, 24, and 32.
  • Extracts LIST/INFO metadata into HashMap<String, String>.
  • Uses aligned buffers (aligned-vec) for SIMD-friendly packet decoding.
  • Performs runtime decoder selection on x86_64:
    • AVX2 when available
    • SSE4.1 otherwise
    • Scalar fallback

Supported format

  • Container: RIFF/WAVE
  • Audio format: PCM (audio_format = 1)
  • Bit depths: 8/16/24/32-bit
  • Endianness: little-endian PCM

Limitations

  • Non-PCM formats are rejected.
  • WAVE_FORMAT_EXTENSIBLE is not implemented yet.
  • Current demo executable reads from a fixed input.wav path in src/main.rs.

Quick start

Prerequisites

  • Rust stable toolchain (see rust-toolchain.toml).

Run demo binary

  1. Place a WAV file named input.wav in the project root.
  2. Run:
cargo run --release

Library usage

use std::fs::File;
use wave_rush::{FallibleStreamingIterator, Result, WavDecoder, WavReader};

fn decode_file(path: &str) -> Result<()> {
    let file = File::open(path)?;
    let reader = WavReader::try_new(file)?;
    let mut decoder = WavDecoder::try_new(reader)?;
    let mut packets = decoder.packets()?;

    while let Some(packet) = packets.next()? {
        // packet: &[i32] with interleaved samples
        let _ = packet;
    }

    Ok(())
}

Development

cargo fmt
cargo clippy --all-targets --all-features -- -D warnings
cargo test

Project structure

  • src/lib.rs: WAV parser, metadata handling, decoders, and tests.
  • src/main.rs: minimal executable example.
  • docs/wave_specification.html: local WAV format reference.

Engineering notes

  • Chunk parsing validates boundaries and alignment bytes.
  • Metadata parsing includes limits (MAX_TAGS, max tag size) to mitigate malformed input risks.
  • Integer arithmetic uses checked operations where overflow could occur.

Status

Active prototype suitable for portfolio/CV presentation and further extension (CLI args, extensible WAV support, benchmarking, CI).

License

No license file is currently included in this repository.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages