3 releases

0.1.2 Apr 9, 2019
0.1.1 Apr 5, 2019
0.1.0 Apr 5, 2019

#969 in Audio

MIT license

7KB
147 lines

mpg123-rs

Latest Version

About

An opinionated wrapper for mpg123-sys.

Usage

let decoder = Decoder::new("assets/a-Ha - Take On Me.mp3", None).unwrap();
println!("{:?}", decoder.format());
let mut samples = Vec::new();

loop {
    let mut buf = vec![0; 2048];
    match decoder.read(&mut buf) {
        Ok(()) => {
            for x in buf.into_iter() {
                samples.push(x);
            }
        }
        Err(Error::EOF) => break,
        Err(e) => panic!(e),
    }
}

Other examples can be found here.

Dependencies

~3MB
~77K SLoC