#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

#1017 in Parser implementations

Download history 1/week @ 2023-12-18 2/week @ 2023-12-25 53/week @ 2024-01-29 184/week @ 2024-02-05 151/week @ 2024-02-12 11/week @ 2024-02-19 27/week @ 2024-02-26 36/week @ 2024-03-04 10/week @ 2024-03-11 97/week @ 2024-03-18 30/week @ 2024-03-25 99/week @ 2024-04-01

242 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–36MB
~516K SLoC