Skip to content

Conversation

@huderlem
Copy link
Member

@huderlem huderlem commented Dec 1, 2025

This corresponds to the following pokeemerald PR:

Today, all of the audio samples exist as .aif files. In general, .aif is a less convenient format compared to .wav. .wav files are much better supported in 3rd party programs (such as virtual instruments). .wav also has first-class support for loop points, whereas .aif only has a generic notion of a "marker". By swapping over to .wav files, it significantly eases both crafting custom instrument samples, as well as using the instrument samples in popular DAW VSTs/plugins (e.g. TX16Wx).

To actually perform the conversion from .wav -> .bin, this incorporates a slightly-modified version of ipatix's wav2agb. The modifications were all in the name of producing perfectly matching output:

  1. Support outputting .bin files with a command line option -b, --binary. (The original only supports outputting .s assembly files.)
  2. Support reading an override "pitch" value from a custom agbp RIFF chunk.
    • This is needed to properly match some samples, due to float-point rounding errors when attempting to infer the pitch/sample rate from the .wav file's sample rate.
    • If the custom agbp chunk isn't present in the source .wav file, it will simply use the .wav's sample rate to calculate this "pitch" value.
  3. Omits trailing padding from compressed output.

I produced these .wav files with this script that converts the GBA format .bin files to .wav files: https://gist.github.com/huderlem/578b22512534891467490b864ca08ae0

Users can also run this script for converting any custom samples.

@huderlem huderlem merged commit 14b76da into pret:master Dec 1, 2025
1 check passed
github-actions bot pushed a commit to SevenSpiders/pokefirered that referenced this pull request Dec 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant