0.0.3 |
|
---|---|
0.0.2 |
|
0.0.1 |
|
#30 in #flac
145KB
3K
SLoC
Cauldron
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
- Wav Reference Document
- Flac Reference Document
- FFmpeg for some algorithm clarity and channel layout understanding
- Claxon for code structure of Input streams
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
~105KB