5 unstable releases
Uses new Rust 2024
| 0.3.0 | Sep 22, 2025 |
|---|---|
| 0.2.1 | Oct 5, 2023 |
| 0.2.0 | Oct 2, 2023 |
| 0.1.1 | Apr 10, 2023 |
| 0.1.0 | Apr 7, 2023 |
#199 in Games
175 downloads per month
29KB
485 lines
HPS Decode
A Rust library for parsing and decoding Super Smash Bros. Melee music files.
Quick Start
Decoding a stereo .hps file into audio and listening to it with
rodio:
Install dependencies:
cargo add rodio --no-default-features --features playback
cargo add hps_decode --features rodio-source
In your main.rs:
use hps_decode::Hps;
use rodio::{OutputStreamBuilder, Sink};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// Decode an .hps file into raw audio data
let hps: Hps = std::fs::read("./respect-your-elders.hps")?.try_into()?;
let audio = hps.decode()?;
// Play it using the rodio crate
let stream_handle = OutputStreamBuilder::open_default_stream()?;
let sink = Sink::connect_new(&stream_handle.mixer());
let source = audio.into_rodio_source();
sink.append(source);
sink.play();
sink.sleep_until_end();
Ok(())
}
Documentation
Check out docs.rs for more details about the library.
Benchmarking
This library can be benchmarked using criterion by running cargo bench. Reports with the results will be generated at target/criterion/report/index.html
.HPS File Layout
For general purpose, language agnostic information about the .hps file format,
see here.
Dependencies
~2–3MB
~67K SLoC