https://github.com/0x08088405/rmp3
fast & safe no_std minimp3 wrapper
https://github.com/0x08088405/rmp3
audio mp3 mp3-decoder rust
Last synced: 6 months ago
JSON representation
fast & safe no_std minimp3 wrapper
- Host: GitHub
- URL: https://github.com/0x08088405/rmp3
- Owner: 0x08088405
- License: cc0-1.0
- Created: 2020-01-19T03:27:11.000Z (over 6 years ago)
- Default Branch: trunk
- Last Pushed: 2023-07-27T00:13:30.000Z (almost 3 years ago)
- Last Synced: 2025-12-14T02:36:50.385Z (6 months ago)
- Topics: audio, mp3, mp3-decoder, rust
- Language: Rust
- Homepage:
- Size: 89.8 KB
- Stars: 14
- Watchers: 2
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.com/notviri/rmp3)
[](https://crates.io/crates/rmp3)
[](https://docs.rs/rmp3)
# rmp3
Idiomatic `no_std` bindings to [minimp3](https://github.com/lieff/minimp3) which don't allocate.
## Documentation
The documentation is hosted online over [at docs.rs](https://docs.rs/rmp3/).
## Usage
Add this to your `Cargo.toml`:
```toml
[dependencies]
rmp3 = "0.3"
```
... or, if you need `std` specific features:
```toml
[dependencies]
rmp3 = { features = ["std"], version = "0.3" }
```
The most basic example is using the provided streaming iterator to decode a file, like so:
```rust
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](#Documentation) for more examples and info.
## Features
- `float`: Changes the sample type to a single-precision float,
and thus decoders will output float PCM.
- **This is a non-additive feature and will change API.**
**Do not do this in a library without notice [(why?)](
https://github.com/rust-lang/cargo/issues/4328#issuecomment-652075026).**
- `mp1-mp2`: Includes MP1 and MP2 decoding code.
- `simd` *(default)*: Enables handwritten SIMD optimizations on eligible targets.
- `std`: Adds things that require `std`,