9 unstable releases

0.4.1 Aug 25, 2018
0.4.0 Dec 2, 2017
0.3.2 Aug 25, 2018
0.3.1 Jun 6, 2017
0.0.1 Feb 13, 2015

#2 in Encoding

Download history 983/week @ 2018-06-03 1714/week @ 2018-06-10 1148/week @ 2018-06-17 746/week @ 2018-06-24 928/week @ 2018-07-01 1012/week @ 2018-07-08 1271/week @ 2018-07-15 790/week @ 2018-07-22 625/week @ 2018-07-29 1078/week @ 2018-08-05 1044/week @ 2018-08-12 915/week @ 2018-08-19 1230/week @ 2018-08-26

4,494 downloads per month
Used in 7 crates (2 directly)

Apache-2.0

152KB
2.5K SLoC

Claxon

A FLAC decoding library in Rust.

Build Status Crates.io version Changelog Documentation

Claxon is a FLAC decoder written in pure Rust. It has been fuzzed and verified against the reference decoder for correctness. Its performance is similar to the reference decoder.

Example

The following example computes the root mean square (RMS) of a FLAC file:

let mut reader = claxon::FlacReader::open("testsamples/pop.flac").unwrap();
let mut sqr_sum = 0.0;
let mut count = 0;
for sample in reader.samples() {
    let s = sample.unwrap() as f64;
    sqr_sum += s * s;
    count += 1;
}
println!("RMS is {}", (sqr_sum / count as f64).sqrt());

More examples can be found in the examples directory. For a simple example of decoding a FLAC file to wav with Claxon and Hound, see decode_simple.rs. A more efficient way of decoding requires dealing with a few details of the FLAC format. See decode.rs for an example.

Performance

These are the times to decode 5 real-world FLAC files to wav, average and standard deviation of 11 runs, normalized to version 1.3.2 of the reference implementation. Measurements were done on a Skylake i7.

Decoder Time / reference
Claxon 1.13 ± 0.03
libflac 1.00 ± 0.03

Contributing

Contributions in the form of bug reports, feature requests, or pull requests are welcome. See contributing.md.

License

Claxon 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 Claxon in your GPLv2-licensed software, you can add an exception to your copyright notice. Please do not open an issue if you disagree with the choice of license.

No runtime deps