• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[GOLD] Music Hacking Resource Document

Melash

Back for now.
  • 426
    Posts
    16
    Years
    MUSIC HACKING RESOURCE DOCUMENT​


    ==============
    Introduction
    ==============

    Before we start out, let me make something clear. This is not a step by step tutorial on how to hack the music in GB/GBC games, but more a resource you can use in hacking. It's a little unorganized, but it should help some people out. Sorry it's a bit long and bleak, I tried to make it a little interesting.

    ==============
    Purpose for writing
    ==============

    This document will list the offsets of all music headers in all games, explain the format of the music headers, and the basic format of the music data

    ==============
    Getting Started
    ==============

    Programs needed:

    A Hex Editor (Use Google)
    Sound Edit v1.3 (https://crystalfallows.110mb.com/AutoIndex/index.php?dir=tools/GSC/&file=soundedit.zip)

    Skills needed:

    Basic usage of a hex editor
    Elementary knowledge of pointers

    ==============
    GSC Music
    ==============

    First off, I'll explain a little about how the music works in GBC. There are up to four channels for every music track; Two are the lead tremble part, one is the bass, and the last is the drums. For every music track, there is a music header. The music header points to where the actual music data is located, the notes and such. Here is a full list of where the music headers are located in GSC, sorted by offset:

    Spoiler:


    Now you know where the headers are located, it's time to learn the format of the music headers. Here is the format of all music formats:

    vv ww ww 01 xx xx 02 yy yy 03 zz zz

    vv: Byte at beginning of header, not exactly sure what it means
    ww ww: 2-byte pointer to first channel
    xx xx: 2-byte pointer to second channel
    yy yy: 2-byte pointer to third channel
    zz zz: 2-byte pointer to fourth channel

    If a music track doesn't have a fourth channel, it simply won't have the pointer to it. Okay, so we now know where all the music headers are located, and their format. Now it's time to learn the format of the actual music data. Here's the note structure for Gold and Silver, I'm assuming it's the same for Crystal:

    Spoiler:


    You can use Sound Edit v1.3 to add in basic notes, but you actually have to go in and manually add in the loop points and other small stuff. Very annoying, but it's the only way to do it.

    ==============
    RBY Music
    ==============

    Since we've already learned the basics of music headers, I won't have to reexplain everything again, I can just give you the offsets. Here are all the locations of music headers in RBY:

    Spoiler:


    The music headers have the same format as GSC. It seems Game Freak doesn't like to change the coding in their games that much. Unfortunately the basic note structure is a little different. Here's the basic note structure for Red and Blue, once again I'm not sure if Yellow is exactly the same:

    Spoiler:

    It's almost the same as GSC. The octave data has changed along with several other bytes. So, you can't import songs from RBY to GSC by using a "copy and pasting" method, but you can manually redo it without too much stress. Unfortunately I only have the basic structure, and not the other data, such as loops points and other information.

    ==============
    Credits
    ==============

    All right, that's all the music data I've found. If you have any questions, or would like me to add in more information, please ask, and I'll gladly do so. Credits go to:
    Coolboyman - Giving me most of the music data format I have here
    Data Crystal - Contained a Gold and Red ROM map where I got my offsets
    If I forgot you, please tell me.
    Fin.
     
    Last edited by a moderator:
    Wow, I've always wondered about 1st gen/2nd gen music editing. This is a pretty good tutorial and it'll help a lot of R/B/Y/G/S/C hackers. :P
     
    Now we just need somebody to make an easy-to-use editor, like sappy!

    I might try this. I'm just not very knowledgeable of Hex.
     
    Actually, a easy-to-use music editor is an excellent idea. If anyone good at programming has this in mind, I can answer all your questions about music hacking, and give you some extra offsets. As of right now, it takes quite a while to insert new music tracks.
     
    Very nice tutorial Melash.
    I'll give this a try though I'm not any music composer :D
     
    RB music data:
    There's 16 different note lenghts in total. Each gets 1/16 longer than the last,
    so here's the complete structure:
    Spoiler:


    D6: play at 2x speed.
    D8: play at 1,5x speed.
    EC xx: Instrument selection.
    FD xx xx: Play at the offset given in the pointer.
    FF: end.

    How drum data works:
    2 bytes for each note.
    xy zz-(x: effect (usually B for drums ), y: note lenght, zz: sound type).
     
    Last edited:
    Hi,

    I've asked this question on various places, but nobody seems to know the answer. Is there a tool to export a song from Pokémon RBY (I need it for yellow)? If soundedit can do that, could you please provide a working download link?
    Also, if not possible, then where can I find a midi (or any editable format) of the Jessie & James encounter theme from yellow? I really can't find it anywhere, and nobody has it.

    Thanks in advance
     
    I have found that Velocity actually determines the note length/echo, not the frames. The frames works a lot like Tempo, but controls delay.

    In velocity, the z value is the echo, while the y determines length (draw out each note, which can overlap with F):
    https://www.youtube.com/watch?v=05NxZyeTVps&feature=player_detailpage#t=343

    Hi,

    I've asked this question on various places, but nobody seems to know the answer. Is there a tool to export a song from Pokémon RBY (I need it for yellow)? If soundedit can do that, could you please provide a working download link?
    Also, if not possible, then where can I find a midi (or any editable format) of the Jessie & James encounter theme from yellow? I really can't find it anywhere, and nobody has it.

    Thanks in advance
    Yeah... um... I seemed to have had difficulty finding the midi converter tool I dug up, and it's not entirely good... I didn't see any exporting tools, sorry. It might be difficult to find one.

    I mean... there might be one, idk.

    E6 xx xx - Tune (not sure what the arguments for this are..)
    This controls pitch, the higher the value, the higher the pitch setting on the music.
     
    Last edited:
    Thansk for this information melash!

    ... but it would be good to have another more updated tutorial to make things easier.
     
    Sorry to bump an old thread, but this line here is incorrect:
    FD 00 ll hh - Jump (this is used to set the loop point for the song, ll = low byte, hh = high byte)
    FD XX YYZZ

    FD - Loop byte
    XX - Number of times to loop, or 00 for infinite.
    YYZZ - In-Bank pointer to location of loop.

    It's pretty funny to come across a jump to a whole rest that makes the whole audio channel just stop. rofl.

    A lot of songs don't end by looping themselves with a call also. A lot tend to end by just jumping back to an earlier point in the song, it will almost always be an infinite loop.
     
    Last edited:
    Back
    Top