Expand description
A library for parsing and decoding Super Smash Bros. Melee music files.
§Quick Start
Decoding a stereo .hps file into audio and listening to it with
rodio:
Install dependencies:
cargo add rodio --no-default-features --features playback
cargo add hps_decode --features rodio-sourceIn your main.rs:
use hps_decode::Hps;
use rodio::{OutputStreamBuilder, Sink};
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// Decode an .hps file into raw audio data
let hps: Hps = std::fs::read("./respect-your-elders.hps")?.try_into()?;
let audio = hps.decode()?;
// Play it using the rodio library
let stream_handle = OutputStreamBuilder::open_default_stream()?;
let sink = Sink::connect_new(&stream_handle.mixer());
let source = audio.into_rodio_source();
sink.append(source);
sink.play();
sink.sleep_until_end();
Ok(())
}§.HPS File Layout
For general purpose, language agnostic documentation of the .hps file format,
see here.
Re-exports§
pub use hps::Hps;
Modules§
- decoded_
hps - Contains
DecodedHpsfor iterating over decoded PCM samples. For looping songs, this is an infinite iterator. While an iterator like this is useful for audio playback, you may need to access the samples directly for other kinds of applications. - decoded_
hps_ rodio_ source rodio-source - Contains
DecodedHpsRodioSourcewhich can be used to play the song using therodiocrate. - hps
- Contains
Hpsfor representing the contents of an.hpsfile in a structured format.