hps_decode

Crates.iohps_decode
lib.rshps_decode
version0.2.1
sourcesrc
created_at2023-04-07 16:37:14.481405
updated_at2023-10-05 01:43:50.390101
descriptionA library for parsing and decoding Super Smash Bros. Melee music files
homepage
repositoryhttps://github.com/DarylPinto/hps_decode
max_upload_size
id833022
size34,711
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

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.

Commit count: 22

cargo fmt