pret / pokecrystal

Disassembly of Pokémon Crystal
https://pret.github.io/pokecrystal/
2.1k stars 802 forks source link

Document the Kanto Trainer battle theme bug #1129

Open SatoMew opened 4 months ago

SatoMew commented 4 months ago

As explained by @dannye on Discord: https://discord.com/channels/442462691542695948/487424856913346580/1255142937055203401

the "bug" is that octave 1 commands are sometimes ignored/treated as octave 2 commands depending on certain transpose settings.

https://discord.com/channels/442462691542695948/487424856913346580/1255143087609483335

so if the bug was fixed, and the octave 1 commands were honored, and you wanted to recreate the original song, then just change them to octave 2.

Rangi42 commented 4 months ago

there are 2 transpose settings: octaves, and pitches. the octave transpose is how many octaves to shift down by, the pitch transpose is how many pitches to shift up by. crystal tracker applys both the octaves down and the picthes up, and then corrects the note if it ends up "out of bounds". but the real game appears to first only apply the octaves down, then fix the note if it is out of bounds, and then apply the pitches up. this means sometimes the real game "over compensates". Music_KantoTrainerBattle uses a transpose setting of 1 octave down and 11 pitches up (as a way of achieving 1 pitch down). this should be absolutely fine because all notes in the channel could feasibly be moved one pitch down.

but for the notes in the lowest octave, when the -1 octave transpose is applied, those notes are "out of bounds" and so the game moves them an octave back up. then the +11 pitch transpose is applied, resulting in those notes in the lowest octave actually being played 1 octave too high for no good reason.