Crates.io | hps_decode |
lib.rs | hps_decode |
version | 0.2.1 |
source | src |
created_at | 2023-04-07 16:37:14.481405 |
updated_at | 2023-10-05 01:43:50.390101 |
description | A library for parsing and decoding Super Smash Bros. Melee music files |
homepage | |
repository | https://github.com/DarylPinto/hps_decode |
max_upload_size | |
id | 833022 |
size | 34,711 |
A Rust library for parsing and decoding Super Smash Bros. Melee music files.
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(())
}
Check out docs.rs for more details about the library.
For general purpose, language agnostic information about the .hps
file format,
see here.