#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

#2544 in Parser implementations

Download history 6/week @ 2024-10-16 11/week @ 2024-10-23 220/week @ 2024-10-30 12/week @ 2024-11-06 15/week @ 2024-11-13 18/week @ 2024-11-20 4/week @ 2024-12-04 22/week @ 2024-12-11 6/week @ 2024-12-18 3/week @ 2024-12-25 12/week @ 2025-01-08 4/week @ 2025-01-15 122/week @ 2025-01-22 7/week @ 2025-01-29

145 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
~441K SLoC