Glitch City Laboratories Archives

Glitch City Laboratories closed on 1 September 2020 (announcement). This is an archived copy of a thread from Glitch City Laboratories Forums.

You can join Glitch City Research Institute to ask questions or discuss current developments.

You may also download the archive of this forum in .tar.gz, .sql.gz, or .sqlite.gz formats.

Generation I Glitch Discussion

Music Fade out during battles - Page 1

Music Fade out during battles

Posted by: Missingno255
Date: 2014-05-29 17:19:08
I don't believe there was a discussion on this AFAIK.

In Generation 1, would anyone happen to know the reason why the music fades out in battle or overworld after doing certain glitches? It happens from the effects of TMTRAINER and when you or opposing opponent (Wild or Trainer) have no pokemon in battle or from the glitch mart in the over world. I did some research using theZZAZZglitch's Pokemon Yellow Debug ROM (Experimenting with this on real hardware (GBA) using Everdrive GB) and found that changing the byte at 0xCFC6 (the start of the battle data) to a non zero value, the music fades out (sound effect at the end of the fade out is different for each hex value). Two other bytes at 0xCFC7 and CFC8 seem to decrement when the music is fading, although CFC6 remains at 00 when done through the "No Pokemon" glitch. I can't seem to figure out for the life of me why this happens XD. Also this post may need to be moved into the Pokemon Red/Blue glitch discussion thread. if it's warranted.

Re: Music Fade out during battles

Posted by: pokechu22
Date: 2014-05-29 19:09:06

I don't believe there was a discussion on this AFAIK.

In Generation 1, would anyone happen to know the reason why the music fades out in battle or overworld after doing certain glitches? It happens from the effects of TMTRAINER and when you or opposing opponent (Wild or Trainer) have no pokemon in battle or from the glitch mart in the over world. I did some research using theZZAZZglitch's Pokemon Yellow Debug ROM (Experimenting with this on real hardware (GBA) using Everdrive GB) and found that changing the byte at 0xCFC6 (the start of the battle data) to a non zero value, the music fades out (sound effect at the end of the fade out is different for each hex value). Two other bytes at 0xCFC7 and CFC8 seem to decrement when the music is fading, although CFC6 remains at 00 when done through the "No Pokemon" glitch. I can't seem to figure out for the life of me why this happens XD. Also this post may need to be moved into the Pokemon Red/Blue glitch discussion thread. if it's warranted.


I did some quick stuff.  This byte is set changed to change music; monitor it when entering/exiting oak's lab.  It must be bank dependent, but on the over world, it seems to switch music.  But it clears the previous channels.  So if it plays a sound effect, too bad, no more music.  Try setting it to [tt]EA[/tt] while in a battle. 

I think I might upload a video of me messing around with this for 20 minutes, even though it would be kind of random. 

EDIT: Video uploading here.

Re: Music Fade out during battles

Posted by: Missingno255
Date: 2014-05-29 21:00:31
Well, that video explains alot. So CFC6 is a pointer to all the SFXes and music depending on what sound bank is loaded. CFC7 and CFC8 are volume controls, possibly. Now I know why that buzzing tone plays when Super Glitch does it's PokePC variant when it asks to switch pokemon and where all the glitch sounds come from (E.G. when Missingno.'s pokedex is displayed). So when you enter battle with no pokemon or opponent has no pokemon, it basically is trying to play invalid music? Doesn't make sense, but that's what I'm getting from this lol.  :o

Re: Music Fade out during battles

Posted by: pokechu22
Date: 2014-05-29 22:15:28

CFC7 and CFC8 are volume controls, possibly.


From what they were doing, I have a better guess, though it still might be wrong: $CFC7 says how long it should take to fade (confirmable by changing it), and $CFC8 counts down rapidly while it is going.  $CFC8 seems to end on the value of $CFC7, which is interesting.

I haven't checked what actualy happens because I can't read assembly.  But it seems likely that it does something like this:


//Would set the music to whatever id corosponds to.  ID seems to be capable of two or more channels, and sound effects.  So it may vary.
void set_music(UBYTE id); //Exrenal function declaration.

extern UBYTE soundVolume; //Where ever this is, but it is what gets set.

UBYTE newSound; //$CFC6
UBYTE soundDelay; //$CFC7
UBYTE soundCountdown; //$CFC8

//Would be called automaticaly without checking what to change it to.
void processSoundChange() {
    if (newSound != 0) {
        if (soundVolume != 0) {
            if (soundCountdown != soundDelay) {
                soundCountdown ++; //Don't remember if it is being added to or subtracted, but either way might make sense...
            } else {
                soundVolume --;
                soundCountdown = 0;
            }
        } else {
            soundVolume = 10; //Or whatever the default full thing is.
            set_music(newSound);
            newSound = 0;
        }
    }
}


I still haven't figured out what $CFC9 is, but it matches $CFC6 in many cases.  I'm also not sure if any of the above is correct.

Re: Music Fade out during battles

Posted by: camper
Date: 2014-05-30 01:49:03
In TMTRAINER effect and ZZAZZ glitch (string buffer overflow), the reason that music fades out is that it's switched to a Pokemon cry. You can hear the cry just after the music stops.

I still wonder where the infinite loop music from several glitch dex entries comes from. When viewing the memory viewer during those loops, it seems that channel isn't playing background music (the corresponding value is constant), so it could be a sound effect…

Re: Music Fade out during battles

Posted by: Missingno255
Date: 2014-05-30 02:08:47

In TMTRAINER effect and ZZAZZ glitch (string buffer overflow), the reason that music fades out is that it's switched to a Pokemon cry. You can hear the cry just after the music stops.

I still wonder where the infinite loop music from several glitch dex entries comes from. When viewing the memory viewer during those loops, it seems that channel isn't playing background music (the corresponding value is constant), so it could be a sound effect…
Yeah I just found that out with TMTRAINER and "No Pokemon" glitch. :D It appears that the RAM from somewhere else is getting corrupted and it's reaching that offset.

You guess is as good as mine where the infinite loop glitch comes from. :P

Re: Music Fade out during battles

Posted by: pokechu22
Date: 2014-05-30 08:02:38

In TMTRAINER effect and ZZAZZ glitch (string buffer overflow), the reason that music fades out is that it's switched to a Pokemon cry. You can hear the cry just after the music stops.

I still wonder where the infinite loop music from several glitch dex entries comes from. When viewing the memory viewer during those loops, it seems that channel isn't playing background music (the corresponding value is constant), so it could be a sound effect…


It's my guess that it is a sound effect.  $CFC6 seems to be able to switch to both sound effects and music while clearly being intended for music only.  The IDs used in it correspond to both.

And text boxes are able to play sound effects - Look at the pewter city jigglypuff.  So it probably is doing a similar thing, just not using a fade. 

Re: Music Fade out during battles

Posted by: camper
Date: 2014-05-30 10:34:33
Playing sound effects as background music is different from playing sound effects as… well, sound effects.

Sound effect channels just block the corresponding music channel during its play, and there's no fadeout.