Skip to content

Conversation

@huderlem
Copy link
Member

Vanilla instruments (and cries) have an off-by-one error in their loop-end. This off-by-one "bug" has been baked into aif2pcm in the past, and was also baked into wav2agb during that recent migration to .wav files. This was potentially problematic for custom samples created over the years because people worked around that off-by-one behavior with their .aif files by specifying an extra "+1" for the loop-end marker in the .aif file. During the .wav migration, this info was lost when translating the .aif -> .wav file, possibly resulting in clear audio artifacts and/or detuning.

I believe the simplest and least paniful way to address this is to mark the vanilla samples as "special" by teaching wav2agb about a new custom chunk called agbl, which contains a loop-end override. This allows vanilla samples to embed their buggy off-by-one loop end, while custom-made samples will work as expected and result in a normal loop end value.

It's possible that there are custom samples out there that rely on the buggy off-by-one behavior. If anyone is affected by that, they can update their samples to include the agbl chunk by running the following command:

./wav2agb --set-agbl -1 my_file.wav

@huderlem huderlem merged commit 338ec9d into pret:master Dec 28, 2025
1 check passed
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