pokemon-synthesizer

Crates.iopokemon-synthesizer
lib.rspokemon-synthesizer
version0.2.0
sourcesrc
created_at2023-04-29 09:04:52.305441
updated_at2023-10-09 18:42:09.333227
descriptionA synthesizer for the sound format of the Pokemon GameBoy games
homepage
repositoryhttps://github.com/LinusU/pokemon-synthesizer
max_upload_size
id851937
size346,044
Linus Unnebäck (LinusU)

documentation

README

Pokemon Synthesizer

A synthesizer for the sound format of the Pokemon GameBoy games.

Implementation status:

  • Gen 1
    • Pulse channels
    • Noise channels
    • Wave channels
    • Finite loops
    • Infinite loops
    • Pitch sweeps
    • Music sequences
  • Gen 2
    • Pulse channels
    • Noise channels
    • Wave channels
    • Finite loops
    • Infinite loops
    • Pitch sweeps
    • Music sequences
  • Future generations

Installation

cargo add pokemon-synthesizer

Usage

const rom = std::fs::read("pokeyellow.gbc").unwrap();

// Pikachu cry
let pcm = pokemon_synthesizer::gen1::synthesis(&rom, 0x02, 0x40c3, 238, -127);

// 1
pcm.channels()

// 1_048_576
pcm.sample_rate()

// Duration { 987.819672ms }
pcm.total_duration()

// Iterator<Item = f32>
pcm.iter()

Testing

In order to run the gen1 tests, you need a ROM file for Pokemon Yellow. The ROM file should have the SHA1 hash cc7d03262ebfaf2f06772c1a480c7d9d5f4a38e1 and be named roms/pokeyellow.gbc.

In order to run the gen2 tests, you need a ROM file for Pokemon Crystal. The ROM file should have the SHA1 hash f4cd194bdee0d04ca4eac29e09b8e4e9d818c133 and be named roms/pokecrystal.gbc.

Acknowledgements

Huge thanks to Retro Game Mechanics Explained for their video on Pokemon cries, and for the accompanying tool. I would not have been able to make this without their help.

Also a big thanks to the pret team for their disassembly of Pokemon Yellow which helped immensely in understanding the sound engine.

Commit count: 17

cargo fmt