hound
A pure-Rust WAV encoding and decoding library with zero runtime dependencies.
Repository Health
Technical Analysis
hound is a WAV (RIFF/WAVE) audio file encoding and decoding library written entirely in Rust, with no runtime dependencies. It provides WavReader and WavWriter types for reading and writing PCM integer and IEEE float samples at any bit depth (8/16/24/32-bit) supported by the WAV format, correctly handling both the simple WAVEFORMATEX and extensible WAVEFORMATEXTENSIBLE header variants used by real-world WAV files.
With nearly 15 million cumulative downloads, hound is one of the most widely used building blocks in the Rust audio ecosystem for anything that needs to read or write .wav files directly — audio analysis tools, synthesizers exporting rendered audio, and test fixtures for higher-level audio libraries like cpal. Its API is deliberately small and typed around WavSpec (channels, sample rate, bit depth, sample format), making straightforward tasks like writing a sine wave or computing RMS from a file just a few lines of code, as shown directly in its own documentation examples.
What You Get
WavWriterfor creating WAV files with a specifiedWavSpec(channels, sample rate, bits per sample, sample format) and writing samples one at a timeWavReaderfor opening and iterating over samples in existing WAV files, including format/spec introspection- Support for both integer PCM and IEEE float sample formats across 8/16/24/32-bit depths
- Correct handling of both
WAVEFORMATEXand the extendedWAVEFORMATEXTENSIBLERIFF header variants found in real-world files - A fuzz-tested decoder (
fuzz/directory with fuzz targets) plus atestsamples/corpus covering many real-world WAV header variants
Common Use Cases
- Writing synthesized or recorded audio samples to a
.wavfile from a Rust application - Reading and analyzing existing WAV files (e.g. computing RMS, converting to mono) in an audio-processing pipeline
- Providing WAV I/O as a lightweight dependency in a synthesizer, DAW, or audio test-fixture crate without pulling in a full multimedia framework
- Round-tripping audio captured via
cpal(see the crate’s ownexamples/cpal.rs) to and from disk for offline processing
Under The Hood
Architecture — The crate is small and flat: src/lib.rs defines the shared WavSpec, error types, and top-level documentation/examples, while src/read.rs and src/write.rs implement WavReader and WavWriter respectively as separate, independently-testable modules that share only the WavSpec data type — there is no shared internal abstraction layer beyond that, keeping the whole library easy to audit. Tech Stack — Pure Rust with zero runtime dependencies (only a cpal dev-dependency for its illustrative recording example); it deliberately pins to an older cpal version in Cargo.toml to preserve compatibility with older Rust toolchains rather than chasing the dependency’s latest release. Code Quality — The testsamples/ directory contains a curated corpus of real-world WAV files covering both header variants and several bit-depth/sample-rate combinations, and the fuzz/ directory holds cargo-fuzz targets exercising the decoder against malformed input, which is a meaningfully high correctness bar for a binary-format parser. API Design — The library’s own doc-comments in lib.rs double as its primary usage guide, showing complete, runnable examples (rendering a sine wave, computing RMS) rather than referring out to separate docs; the WavSpec struct groups all format parameters into one typed value passed to both reader and writer, so there’s a single mental model for describing a WAV file’s shape.
Used by 6 apps in this directory
Epicenter
Knowledge Management · Note Taking · Developer Tools
A local-first monorepo led by Whispering, an open-source speech-to-text app, built on an MIT toolkit that turns your data into plain Markdown and SQLite files you own instead of a database you rent.
Fyrox
Game Development
A production-ready 2D/3D game engine written in Rust with a built-in scene editor, physics, and hot-reloading game scripts
Handy
Productivity
Free, offline, open-source speech-to-text that pastes directly into any app on Windows, macOS, and Linux.
RustDesk
Networking
Open-source, self-hosted remote desktop built in Rust — your data, your infrastructure, no third-party cloud.
Spacedrive
File Storage · Collaboration
One file manager for all your devices and clouds — powered by a Virtual Distributed File System built in Rust.
Voicebox
AI Development · Productivity
Clone voices, dictate anywhere, and give AI agents your voice — all locally.