Anonymous user
Professor Oak's lab music glitch: Difference between revisions
m
Text replacement - "~" to "–"
>Sherkel No edit summary |
m (Text replacement - "~" to "–") |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1:
{{researchneeded|Can this glitch happen in other cutscenes?}}
{{clr}}
The '''Professor Oak's lab music glitch''' occurs in {{RB}}. Very rarely at the beginning of the game after the player is led to Professor Oak's lab, the Professor Oak's lab theme that starts playing would be glitched. It can either sound like a simplified and slower version of
This glitch happens because one of the three audio channels (Ch0, Ch1, Ch2) of Professor Oak's lab theme is ended before it starts. Among those channels, Ch1 is the main tune, but Ch0 contains the audio commands to set the tempo of the music. As a result:
{{Youtube|pjS8gt_5Urg|ChickasaurusGL}}▼
* If Ch0 is glitched out, then the tempo will remain at the default value 256 (0x0100), instead of 140 (0x008C; larger number is slower). Therefore the music is slower, and also simpler because one of the side channels is not played. <!-- TODO: Translate the numbers into BPM? -->
* If Ch1 is glitched out, then the main tune will not be played, making the music sound very different.
* If Ch2 is glitched out, then the music also becomes simpler, but it's a less noticeable effect than the two previous cases.
==Triggering mechanism==
[[Category:Generation I glitches]]▼
The glitch is triggered when the V-Blank interrupt occurs in the middle of loading a channel. The loading of a piece of music is handled in the game code as follows:
* All relevant memory addresses are set to 0x00, 0x01, or 0xff, as appropriate. (This includes the aforementioned default tempo, 0x0100.)
* For each channel:
** The sound ID for that channel (wChannelSoundIDs, 8 bytes, $C026–$C02D) is set to the ID of the music.
** The command pointer for that channel (wChannelCommandPointers, 8 pointers of 2 byte each, $C006–$C015) is set to the beginning of the audio commands for that channel.
If the V-Blank interrupt occurs between setting the sound ID and setting the command pointer, it will try to play the music (because the sound ID is nonzero), but will execute the command from $0000 instead of the correct command pointer. That address is at the beginning of the ROM and contains the value 0xFF, which is interpreted as an "end channel" command. This sets the sound ID for the channel back to zero.
When the control flow goes back to the music loading routine, it will set the correct command pointer, but the sound ID remains zero. Therefore the channel will not be played in any subsequent frames, essentially ended before it begins.
This glitch cannot happen if the previous music is faded out before the current music begins (overworld map transitions usually work this way). The reason is that in this case the music loading routine is called by FadeOutAudio, which is itself called during the V-Blank. Since the V-Blank cannot interrupt itself, the glitch cannot be triggered.
==YouTube videos==
(@1:34; Ch0 glitched out)
{{YouTube|7MI_s3xcE-c|gifvex}}
(@1:18; Ch1 glitched out; notice that some notes are masked out by the text box jingles, which also play in Ch0)
▲[[Category:Generation I glitches]][[Category:Music glitches]]
|