Hound
A wav encoding and decoding library in Rust.
Hound can read and write the WAVE audio format, an ubiquitous format for raw, uncompressed audio. The main motivation to write it was to test Claxon, a FLAC decoding library written in Rust.
Examples
The following example renders a 440 Hz sine wave, and stores it as a mono wav file with a sample rate of 44.1 kHz and 16 bits per sample.
use PI;
use i16;
use hound;
let spec = WavSpec ;
let mut writer = create.unwrap;
for t in .map
The file is finalized implicitly when the writer is dropped, call
writer.finalize()
to observe errors.
The following example computes the root mean square (RMS) of an audio file with at most 16 bits per sample.
use hound;
let mut reader = open.unwrap;
let sqr_sum = reader.
.fold;
println!;
Features
Read | Write | |
---|---|---|
Format | PCMWAVEFORMAT , WAVEFORMATEX , WAVEFORMATEXTENSIBLE |
WAVEFORMATEXTENSIBLE |
Encoding | Integer PCM, IEEE Float | Integer PCM |
Bits per sample | 8, 16, 24, 32 (integer), 32 (float) | 8, 16, 24, 32 (integer) |
License
Hound is licensed under the Apache 2.0 license. It may be used in free software as well as closed-source applications, both for commercial and non-commercial use under the conditions given in the license. If you want to use Hound in your GPLv2-licensed software, you can add an exception to your copyright notice.