• Stars
    star
    285
  • Rank 145,115 (Top 3 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A FLAC decoder in Rust

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. Claxon was compiled with Rust 1.26.0.

Decoder Time / reference
Claxon 1.10 ± 0.01
libflac 1.00 ± 0.01

Note that for decent performance, Claxon should be compiled with -C codegen-units=1 on Rust ≥ 1.24.0. Not passing this RUSTFLAG can cause as much as a 45% increase in running time.

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.

More Repositories

1

hound

A wav encoding and decoding library in Rust
Rust
464
star
2

rcl

A reasonable configuration language
Rust
175
star
3

blog

My personal site
Haskell
122
star
4

pris

A language for designing slides
Rust
115
star
5

robigo-luculenta

Proof of concept spectral path tracer in Rust
Rust
106
star
6

musium

Music playback daemon with web-based library browser
Rust
81
star
7

luculentus

Proof of concept spectral path tracer
C++
46
star
8

convector

Interactive CPU path tracer
Rust
45
star
9

thread-id

Get a unique thread ID in Rust
Rust
41
star
10

filebuffer

Fast and simple file reading for Rust
Rust
35
star
11

noblit

An immutable append-only database
Rust
27
star
12

bs1770

A Rust library that implements ITU-R BS.1770-4 loudness measurement
Rust
18
star
13

kilsbergen

A clean MkDocs theme
HTML
10
star
14

transducers

A transducer library for Rust
Rust
10
star
15

hoff

A gatekeeper for your commits
Haskell
8
star
16

rx

Reactive programming for Rust
Rust
8
star
17

sempervivum

A plant watering tracker
PureScript
8
star
18

tako

Updater for single files
Rust
7
star
19

sqlog

Ingest Nginx logs into a SQLite database for easy querying
Python
7
star
20

notes

Make Git remember so I don’t have to
6
star
21

dotfiles

My universal personal configuration
Vim Script
5
star
22

deadlock

Fast search-based password manager
C++
5
star
23

miniserver

Nginx and Lego on Flatcar Linux
Python
5
star
24

hanson

Self-hosted prediction market app
Python
5
star
25

fibint

Compute Fibonacci numbers efficiently using finite fields
C++
4
star
26

squiller

Generate boilerplate from annotated SQL queries
Rust
4
star
27

bscthesis

The source for my bachelor’s thesis
TeX
3
star
28

gitscrobbler

Cross-reference commit history with your Last.fm scrobbles
C#
3
star
29

zerorack

Experiments with circuit compilation and zk-snarks
Haskell
3
star
30

hitsgame

Create your own version of the game Hitster
Python
3
star
31

btrfs-mirror-subvolumes

Mirror btrfs subvolumes to another file system while preserving sharing
Rust
2
star
32

rust-utrecht

Source code to go with the Rust Utrecht meetups
Rust
2
star
33

audiograter

A GTK-based spectrogram viewer
Rust
2
star
34

adventofcode

My solutions to Advent of Code
Pony
1
star
35

basstrace

Visualize room acoustics
Rust
1
star
36

christmas-tree

An API for lighting up my Christmas tree
Haskell
1
star
37

git-dep

A tool to manage dependent branches
Haskell
1
star
38

deepnote

Generate track embeddings based on listening history
Python
1
star
39

ggj15

Global Game Jam 2015 game
C#
1
star