#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

#2438 in Parser implementations

Download history 24/week @ 2024-07-22 40/week @ 2024-07-29 18/week @ 2024-08-05 1/week @ 2024-08-12 103/week @ 2024-09-02 144/week @ 2024-09-09 23/week @ 2024-09-16 14/week @ 2024-09-23 1/week @ 2024-09-30 20/week @ 2024-10-07 8/week @ 2024-10-14 6/week @ 2024-10-21 150/week @ 2024-10-28 88/week @ 2024-11-04

253 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–34MB
~474K SLoC