Crates.io | rmp3 |
lib.rs | rmp3 |
version | 0.3.1 |
source | src |
created_at | 2020-01-21 05:34:52.427703 |
updated_at | 2021-02-23 09:36:57.000138 |
description | fast & safe no_std minimp3 wrapper |
homepage | https://github.com/notviri/rmp3 |
repository | https://github.com/notviri/rmp3 |
max_upload_size | |
id | 200671 |
size | 113,361 |
Idiomatic no_std
bindings to minimp3 which don't allocate.
The documentation is hosted online over at docs.rs.
Add this to your Cargo.toml
:
[dependencies]
rmp3 = "0.3"
... or, if you need std
specific features:
[dependencies]
rmp3 = { features = ["std"], version = "0.3" }
The most basic example is using the provided streaming iterator to decode a file, like so:
use rmp3::{Decoder, Frame};
let mp3 = std::fs::read("test.mp3")?;
let mut decoder = Decoder::new(&mp3);
while let Some(frame) = decoder.next() {
if let Frame::Audio(audio) = frame {
// process audio frame here!
imaginary_player.append(
audio.channels(),
audio.sample_count(),
audio.sample_rate(),
audio.samples(),
);
}
}
Check out the documentation for more examples and info.
float
: Changes the sample type to a single-precision float,
and thus decoders will output float PCM.
mp1-mp2
: Includes MP1 and MP2 decoding code.simd
(default): Enables handwritten SIMD optimizations on eligible targets.std
: Adds things that require std
,