#smash #music #super #decoding #audio #decode #parser

hps_decode

A library for parsing and decoding Super Smash Bros. Melee music files

4 releases

0.2.1 Oct 5, 2023
0.2.0 Oct 2, 2023
0.1.1 Apr 10, 2023
0.1.0 Apr 7, 2023

#13 in #smash

Download history 19/week @ 2024-11-15 14/week @ 2024-11-22 11/week @ 2024-12-06 20/week @ 2024-12-13 1/week @ 2024-12-20 3/week @ 2024-12-27 14/week @ 2025-01-10 48/week @ 2025-01-17 79/week @ 2025-01-24 4/week @ 2025-01-31 6/week @ 2025-02-07 51/week @ 2025-02-14 99/week @ 2025-02-21 154/week @ 2025-02-28

310 downloads per month

MIT license

25KB
461 lines

HPS Decode

Latest Version Rust Documentation Build Status

A Rust library for parsing and decoding Super Smash Bros. Melee music files.

Quick Start

Here is a quick example of how to play a stereo .hps file with the rodio-source feature flag and rodio 0.17:

use hps_decode::Hps;
use rodio::{OutputStream, Sink};
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    // Decode an .hps file into PCM samples for playback
    let hps: Hps = std::fs::read("./respect-your-elders.hps")?.try_into()?;
    let audio = hps.decode()?;

    // Play the song with the rodio library
    let (_stream, stream_handle) = OutputStream::try_default()?;
    let sink = Sink::try_new(&stream_handle)?;

    sink.append(audio);
    sink.play();
    sink.sleep_until_end();

    Ok(())
}

Documentation

Check out docs.rs for more details about the library.

.HPS File Layout

For general purpose, language agnostic information about the .hps file format, see here.

Dependencies

~2–30MB
~438K SLoC