#audio #decoder #flac #wav #mp3

cauldron

Pure rust audio decoder for wav, flac, mp3 and aac

3 releases

0.0.3 Jul 19, 2020
0.0.2 Dec 28, 2019
0.0.1 Nov 26, 2019

#94 in Audio

Apache-2.0

140KB
3K SLoC

Cauldron

Build Status Crates.io docs.rs

A lightweight implementation of decoders for popular used audio formats [Flac, Wav, Mp3, Ogg, etc.] in pure Rust.

Features

Planned features are:

  • Decode and maybe Encode support for the most popular audio codecs
  • Providing a WASM API for web
  • Try supporting no_std environment

Codec Format Support Roadmap

Format Flag Read Write
AAC aac - -
Flac flac Done -
MP3 mp3 InProgress -
PCM pcm - -
WAV wav Done InProgress
Vorbis vorbis - -

Usage

Add this to Cargo.toml file:

[dependencies]
cauldron = "0.0.2"

Example code:

use cauldron::audio::AudioSegment;
use cauldron::codecs::FormatFlag;

let mut audio_segment = match AudioSegment::read("<path-to-audio-file>", FormatFlag::WAV) {
  Ok(f)  => f,
  Err(e) => panic!("Couldn't open example file: {}", e)
};

// display some audio info
println!("{}", audio_segment);


let samples: Vec<i32> = audio_segment.samples().unwrap().map(|r| r.unwrap()).collect();
println!("total samples {}", samples.len());

An example to play an audio can be found in examples/play.rs. To play any audio just run:

cargo run --example play <path-to-audio-file>

Acknowledgements

Contributing

Right now project is still in very early stages, so I am not looking for any contributions, but if you see any bug or improvement in existing implementation feel free to open an issue.

Dependencies