• 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.

[Pokeemerald] How To Add, Edit, And Understand Music in Pokeemerald

247
Posts
6
Years
    • Seen May 12, 2024
    Just did a big update to the main post:

    - Cleaned up the overall appearance
    - Added a new section regarding working with .mid files
    - Re-worded certain sections and other minor changes
     
    3
    Posts
    326
    Days
    • Seen Oct 25, 2023
    Did they move where I was supposed to fix the values for gba to be able to read 16 tracks instead of the default 10? I'm looking through the files it said to use and it isn't the same as it was so I have no idea if the place to find the values to increase it changed or not. If someone could help that would be great thanks.
     
    247
    Posts
    6
    Years
    • Seen May 12, 2024
    Did they move where I was supposed to fix the values for gba to be able to read 16 tracks instead of the default 10? I'm looking through the files it said to use and it isn't the same as it was so I have no idea if the place to find the values to increase it changed or not. If someone could help that would be great thanks.

    You are correct, that has changed with the more recent versions of pokeemerald/pokefirered. To increase the track count, just go to sound/music_player_table.inc and make this change:
    Code:
    .equiv NUM_TRACKS_BGM, 10
                           ↓↓
    .equiv NUM_TRACKS_BGM, 16
    This one change is all that you need now. I had forgotten to update this on the main post, so thanks for pointing it out!
     
    3
    Posts
    326
    Days
    • Seen Oct 25, 2023
    One more question I forgot to ask was where in the voice group would I change the sound of channel 10 or the percussion channel? I don't know if it was explained or not above I'm probably blind but I'm not really sure what line it would go into for the voicegroup file or if it's located somewhere else. Only reason I'm asking is because it's making an annoying sound and I'm not sure where to change the instrument to what it's supposed to be.
     
    247
    Posts
    6
    Years
    • Seen May 12, 2024
    ....where in the voice group would I change the sound of channel 10 or the percussion channel?

    The percussion voice in pokeemerald is usually represented as voice_keysplit_all voicegroup002 in a voicegroup. This means that the percussion instruments are held within voicegroup002, or even voicegroup003 or voicegroup004 due to how voice_keysplit_all voices work, so any changes you want to make to the percussion should be done in those voicegroups. Make sure you know how voice_keysplit_all voices work, and also be sure you know what percussion instruments are within voicegroup002/3/4 and WHERE they are within voicegroup002/3/4, since the pokeemerald percussion doesn't always line up nicely with the usual midi percussion.
    Only reason I'm asking is because it's making an annoying sound and I'm not sure where to change the instrument to what it's supposed to be.
    The odds are one of the percussion instruments that you're using is at an index in voicegroup002/3/4 where there is no percussion instrument, so the game is just using a square wave instead, which would sound pretty bad for percussion. If you're wanting to make changes, the best solution would be to change the problematic percussion instrument you're using to the proper index of the percussion instrument you want within voicegroup002/3/4. For example, if you're wanting to use the snare drum voice, which (for the sake of this example) is at index 8 in your midi software, but the snare drum is at index 10 in voicegroup002, you would change the percussion instrument in your midi to be whatever percussion instrument that is at index 10. Even if that's the wrong instrument in the midi software, it will be the correct instrument in-game. How you do that exactly will depend on the midi software that you use.

    There is also the possibility that pokeemerald does not have the instrument you're trying to use. In that case, you would need to add your own sample to pokeemerald, then add that sample to voicegroup002/3/4 and remember where within those voicegroups you've placed that sample. To access that instrument in your midi, be sure to use the percussion instrument in your midi software that is at the same index as wherever you placed this new sample.

    If that doesn't make sense, I can elaborate a bit further with pictures.
     
    3
    Posts
    326
    Days
    • Seen Oct 25, 2023
    So sorry for the late response. Could you send some pictures because it still isn't working.
     
    247
    Posts
    6
    Years
    • Seen May 12, 2024
    So sorry for the late response. Could you send some pictures because it still isn't working.

    First, make sure you know where the percussion voice is in your voicegroup. Here's a snippet of my voicegroup that I usually use:
    Spoiler:
    The arrow is pointing at the percussion voice. This is at index 96 within the voicegroup, or you could say it is the 97th voice in this voicegroup. Since this is at index 96, I have to use the instrument that is at index 96 in my midi editor to access the percussion when I put the song into the game. For most midi editors, the voice that is at index 96 is something like this:
    Spoiler:
    Now whatever notes are in channel 9 for this midi will be using the percussion voice once I put the song into the game. Do keep in mind that, if you don't put your percussion voice all the way at the end of your voicegroup (which would be at index 127, or the 128th voice), all of the instruments after the percussion voice will be offset by 1. So if I wanted to use the FX 1 (rain) voice now, I would use the FX 2 (soundtrack) voice in the midi, which would then translate to FX 1 (rain) in-game. Even if you do put the percussion voice at the end, you will still be cutting off the last voice in the voicegroup, which is usually something like a gunshot voice. I don't know why I went with 96 for my percussion voice, but that's what I chose.

    You will have to deal with the following issues:

    If you are using the standard percussion voice from pokeemerald, most of the instruments will not line up with how the instruments line up in your standard midi percussion voice. For example, standard midi percussion has an open hi-hat voice at As1. The standard pokeemerald percussion has a crash cymbal hit at As1. Where midi percussion has a hand clap at Ds1, pokeemerald percussion has a square wave, which isn't a percussion instrument at all. There are a few instruments that line up, but they are very few and far between. What this means is that you will need to rearrange the percussion notes in your midi to match with pokeemerald's percussion layout, rather than the standard midi percussion layout. Otherwise, your percussion sounds awful in-game. To give some context, here's a picture of the beginning of the percussion voicegroup in pokeemerald:
    Spoiler:
    (I have added some samples, like eggshaker and ridecymbal. I also work on an older version of pokeemerald, so if some of what you see doesn't line up 1-to-1 with what you see in your repo, that's why)

    You will see that, for some reason, there are a few normal instruments at the beginning of this voicegroup. I don't know why they're there, but they were there when I first looked into this stuff. If you look at the voice at index 4 (aka the 5th instrument), you'll see we start to get actual percussion voices, starting with a snare drum. You will also note that I wrote which note this particular voice relates to all the way to the right of the voice: EnM2. Note that the voicegroup starts at CnM2, which is the lowest possible note in pokeemerald. It then keeps walking up a half-step per voice, eventually capping out at Gn8. Even if there aren't enough voices in this voicegroup to go all the way from CnM2 to Gn8, the game will just jump to the next voicegroup to be able to reach higher and higher indices. That's why, if you were to look at voicegroup003 and voicegroup004, you would see more percussion voices. Going back to that snare drum at EnM2, if you use an EnM2 note for this voice, it will play that snare drum sample.

    WARNING: there is an unfortunate discrepancy between how the game refers to notes and how midi editors, or at least MidiEditor, refers to notes. For some reason, if I have a note at Cn1 in the midi, it will be read in as Cn0 in the .s file that is created from the midi file. It will still sound the same for normal pitch-based voices, but they are marked differently. This can be a little annoying, because you will have to remember this as you rearrange your percussion notes. If you wanted to use this snare drum, you would place a note at EnM1 in your midi, NOT at EnM2. When your midi is converted into a .s file, that note will be automatically turned into EnM2, which puts you at the right index to access the snare drum. Again, this may be just with MidiEditor. I haven't worked with any of the other popular midi editors like Anvil Studio, so I can't say for certain that this is a universal issue.

    You could also create a new percussion voicegroup in pokeemerald that has a similar layout to the midi percussion layout. I've started working on that recently myself. There will be several instruments in the midi percussion that aren't represented in pokeemerald's sample selection, like record scratches and castanets. If you want a completely full percussion voice, you will have to add some samples. But don't worry, a large chunk of the standard voices are present in pokeemerald. Standard midi percussion will have more versions of some voices, though. For example, midi percussion has 6 tom voices, whereas pokeemerald has 2 tom voices. So unless you add in more tom samples, you will need to reuse those two voices multiple times to fill out the percussion voicegroup. Also, midi percussion usually starts at Ds0, and goes all the way up to Ds5. This means you would need to start your custom percussion voicegroup in pokeemerald at DsM1, and go up to Ds4, assuming you need to account for that annoying discrepancy with your midi editor that I mentioned earlier.

    All of that to say, regarding your issue with a weird sound being played in your percussion, there is a decent chance that, due to the difference between the midi percussion layout and the pokeemerald percussion layout, one of the percussion instruments that you're using lines up with a square wave in pokeemerald, which would create a real ugly sound. It may also just be lining up with a percussion instrument that sounds nothing like the one that you're trying to use at that time. I don't have the midi you are using, nor do I know what voicegroup that you're using, so I can't provide any more help than this. If this doesn't clear it up for you and you still need help, you can PM me and send your midi and the voicegroup that you're using, and I should be able to help you out a lot more that way.
     
    Last edited:
    13
    Posts
    319
    Days
    • Seen today
    Hey,
    Thanks for this tutorial, I could add a fewx songs to my projects.
    But I realized that some of my songs didn't loop like all the music in the game.
    For example it play for about 1min (the lenght of the song) and then, nothing except the collision noises.
    The song is back again if it is reload (battle, other location etc.)

    Did this happened to any of you?

    Thanks
     
    247
    Posts
    6
    Years
    • Seen May 12, 2024
    Hey,
    Thanks for this tutorial, I could add a fewx songs to my projects.
    But I realized that some of my songs didn't loop like all the music in the game.
    For example it play for about 1min (the lenght of the song) and then, nothing except the collision noises.
    The song is back again if it is reload (battle, other location etc.)

    Did this happened to any of you?

    Thanks

    Did you apply loop points in your song? This can be done either in the midi by placing a "[" text event at the beginning of your loop and a "]" text event at the end of your loop, or you can make your loop points in the .s file of your song by creating a label at the same measure in each track of your song where the loop starts, and then place a GOTO command at the end of your loop in each track that goes back to that label.

    You can see how to do the midi process in the "How to Work with .mid Files" section of the tutorial, specifically the "Looping Songs" sub-section, or you can look into the ".s Files" section to learn more about how to handle looping within the .s file.
     
    13
    Posts
    319
    Days
    • Seen today
    Did you apply loop points in your song? This can be done either in the midi by placing a "[" text event at the beginning of your loop and a "]" text event at the end of your loop, or you can make your loop points in the .s file of your song by creating a label at the same measure in each track of your song where the loop starts, and then place a GOTO command at the end of your loop in each track that goes back to that label.

    You can see how to do the midi process in the "How to Work with .mid Files" section of the tutorial, specifically the "Looping Songs" sub-section, or you can look into the ".s Files" section to learn more about how to handle looping within the .s file.

    It works well !! Thanks a lot.
    And yes, I can't read. Sorry about that..
     
    1
    Posts
    268
    Days
    • Seen Aug 24, 2023
    Have you ever wanted to add in custom music to your ROM hack, but never knew how to get it done, or even where to start? Well, this here thread has everything you'll ever need to know about adding and editing music in Pokeemerald!....or at least everything that I know at this moment in time. I've done my fair share of digging into how the music works in this game, and I feel like everyone else shouldn't need to dig through the same dirt that I had to.

    I've split this into a few different segments, each segment being supported by the prior. So, if you already know about some of the initial stuff, you can just skip to whatever part you aren't so knowledgable on.

    How the Game Reads Music
    Spoiler:


    How To Turn a .mid File Into a .s File
    Spoiler:


    The Different Types of Voices of the GBA
    Spoiler:


    Voicegroups
    Spoiler:


    Voice Envelopes
    Spoiler:


    How to Add a Voicegroup
    Spoiler:


    How to Add a Voice
    Spoiler:


    .s Files
    Spoiler:


    How to Work with .mid Files
    Spoiler:


    How to Add a New Song To Your ROM
    Spoiler:


    Editing a Song That's in Your ROM
    Spoiler:

    Limitations of the GBA (And How to Get Past Some of Them)
    Spoiler:


    With all of this knowledge at your disposal, you should be able to add all sorts of songs to your ROM hack. To wrap this tutorial up in a nice bow, I'll actually walk through adding a song into my own ROM hack, from beginning to end.

    Full Step-by-Step Example
    Spoiler:


    And with that.....I think I've said just about everything I can say on ROM music editing. If I come across any new insights on better methods or greater understanding on how different commands work, or if someone else posts something that explains an element of music hacking that I couldn't explain originally, I'll add it in to this tutorial. I hope this tutorial will spark a lot of people's musical interest and introduce all sorts of new songs into ROM hacks. I can't wait to see, or should I say hear, what you guys come up with!

    Im sorry to bother you but would any of this work for White 2? im new to the rom hacking scene and I am so confused on how to add or change music from that game.
     
    Back
    Top