hps_decode

Crates.iohps_decode
lib.rshps_decode
version0.3.0
created_at2023-04-07 16:37:14.481405+00
updated_at2025-09-22 01:20:44.406175+00
descriptionA library for parsing and decoding Super Smash Bros. Melee music files
homepage
repositoryhttps://github.com/DarylPinto/hps_decode
max_upload_size
id833022
size68,268
Daryl Pinto (DarylPinto)

documentation

README

HPS Decode

Latest Version Rust Documentation Build Status

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.

Commit count: 35

cargo fmt