• 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 today
    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!
     

    Attachments

    • wind_scene_final.s
      35.1 KB · Views: 12
    • wind_scene_initial.s
      34.5 KB · Views: 2
    Last edited:
    118
    Posts
    4
    Years
  • Great job! I've been looking forward to this. I actually whipped up a song just to try it, and it almost sounds good. I thought I would ask for your help. The issue is the drums. I think there's a note they have trouble playing because there's this blaring noise sometimes that really distracts. It's really noticeable in the beginning and the end of the song. Without that issue, the song would sound pretty good for a first attempt. Here is the source file and a video of the song playing: https://www.mediafire.com/folder/vtbqayck0mnik/Colosseum_Midi
     
    247
    Posts
    6
    Years
    • Seen today
    Great job! I've been looking forward to this. I actually whipped up a song just to try it, and it almost sounds good. I thought I would ask for your help. The issue is the drums. I think there's a note they have trouble playing because there's this blaring noise sometimes that really distracts. It's really noticeable in the beginning and the end of the song. Without that issue, the song would sound pretty good for a first attempt. Here is the source file and a video of the song playing: https://www.mediafire.com/folder/vtbqayck0mnik/Colosseum_Midi
    Well, you are right, the problem is indeed related to the drums. You currently have your drums playing several Gs0 notes near the beginning and end of the song. That note is a voice_square_1 voice within voicegroup002, since you're using that voicegroup via voice_keysplit_all. If you make each of those Gs0 notes within your drum track to be GnM2 notes, I think you'll get a much better sound. If you don't like that kick, you can also try making them Cn1 notes, which will create a different type of kick drum sound.

    I also noticed that you have several As1 notes being used in your drum track. I'm not too familiar with the original song, but I know that most midi drums set As1 to be a released high-hat sound, but pokeemerald sets As1 to be a snare drum sound. You may want to check that section to see if you actually want those notes to be snare drums rather than high-hat hits. The notes seem to span from measures 004 - 011 in the .s file, or measures 5 - 12 in your .mid file.
     
    Last edited:
    118
    Posts
    4
    Years
  • Well, you are right, the problem is indeed related to the drums. You currently have your drums playing several Gs0 notes near the beginning and end of the song. That note is a voice_square_1 voice within voicegroup002, since you're using that voicegroup via voice_keysplit_all. If you make each of those Gs0 notes within your drum track to be GnM2 notes, I think you'll get a much better sound. If you don't like that kick, you can also try making them Cn1 notes, which will create a different type of kick drum sound.

    I also noticed that you have several As1 notes being used in your drum track. I'm not too familiar with the original song, but I know that most midi drums set As1 to be a released high-hat sound, but pokeemerald sets As1 to be a snare drum sound. You may want to check that section to see if you actually want those notes to be snare drums rather than high-hat hits. The notes seem to span from measures 004 - 011 in the .s file, or measures 5 - 12 in your .mid file.

    Thanks! If I wanted to change the notes from high-hats to snare drums, what note would I set it to from As1? Still don't know how to navigate keysplits, sorry.

    Also, I just noticed that there's a problem with the looping in the song. I think one of the instruments is out of sync. I tried to add looping via putting brackets in the midi notes, but that didn't work, so I just did what you did in your tutorial. The only problem is that not every instrument had notes for every measure, so I put rests in manually, but I think I messed something up. I added an updated .s file and a midi that plays the updated song 1 and a half times.
     
    Last edited:
    247
    Posts
    6
    Years
    • Seen today
    Thanks! If I wanted to change the notes from high-hats to snare drums, what note would I set it to from As1?
    You wouldn't do anything. As1 IS a snare drum sound in pokeemerald. If you were wanting to change the notes from snare drums to high-hats, on the other hand, you'd change each As1 within your drum track to FnM1. That'll give you the open high-hat sound that is usually given to As1 in midi drumsets.

    Still don't know how to navigate keysplits, sorry.
    If you take a glance through the "Voicegroups" section of this tutorial, you can get an explanation of both voice_keysplit and voice_keysplit_all voices.
     
    118
    Posts
    4
    Years
  • You wouldn't do anything. As1 IS a snare drum sound in pokeemerald. If you were wanting to change the notes from snare drums to high-hats, on the other hand, you'd change each As1 within your drum track to FnM1. That'll give you the open high-hat sound that is usually given to As1 in midi drumsets.


    If you take a glance through the "Voicegroups" section of this tutorial, you can get an explanation of both voice_keysplit and voice_keysplit_all voices.

    Sorry, I worded that first question wrong. Also, I guess by not knowing how to navigate voice groups, I meant more knowing how to figure out which note corresponded to which drum sample. Thanks! All I need to figure out is the looping problem and I should be decently good to go.
     
    247
    Posts
    6
    Years
    • Seen today
    Also, I guess by not knowing how to navigate voice groups, I meant more knowing how to figure out which note corresponded to which drum sample.
    I explain how to figure out which notes go to which sample when discussing voice_keysplit_all voices within the "Voicegroup" section.
    All I need to figure out is the looping problem and I should be decently good to go.
    In Track 6 of your .s file, measure 025 needs to wait another 6 time units before going to measure 026. Making that last wait command in the measure be W12 instead of W06 should do the trick.
     
    118
    Posts
    4
    Years
  • You're the best! Thank you so much. As thanks, let me link the song here for anyone else who wants to use it.
    Original Song
    Midi (Originally by Pedro Goralski)
    .s file
    Voicegroup:
    Code:
    .align 2
    voicegroup194::
    	voice_directsound 60, 0, DirectSoundWaveData_sc88pro_glockenspiel, 255, 165, 51, 242 @ Glockenspiel
    	voice_keysplit_all voicegroup002 @ Drums
    	voice_directsound 60, 0, violin, 255, 255, 0, 221 @ Violin
    	voice_square_1_alt 60, 0, 0, 2, 0, 0, 15, 0 @ Square
    	voice_keysplit voicegroup009, KeySplitTable5 @ French Horn
    	voice_keysplit voicegroup006, KeySplitTable2 @ string ensemble
    	voice_directsound 60, 0, violin, 255, 255, 0, 221 @ Violin
    	voice_keysplit voicegroup009, KeySplitTable5 @ French Horn
    	voice_directsound 60, 0, DirectSoundWaveData_sc88pro_piano1_72, 255, 250, 0, 221 @ Piano
    NOTE: You'll need to add the violin sample yourself. I got it from WiserVisor themself, so they'd need to post it. If you can't get one, a string ensemble should be good enough, I think.
     
    4
    Posts
    3
    Years
    • Seen Mar 11, 2021
    I don't have any experience with music in general, but regarding .midi to .s files, I always assumed it happened simply by making the ROM, much like .png to .4bpp or .pal to .gbapal. Shot in the dark, but can you not simply add the new songs to the songs.mk file?
     
    247
    Posts
    6
    Years
    • Seen today
    I don't have any experience with music in general, but regarding .midi to .s files, I always assumed it happened simply by making the ROM, much like .png to .4bpp or .pal to .gbapal. Shot in the dark, but can you not simply add the new songs to the songs.mk file?
    You are quite right! I was using an old version of pokeemerald that didn't have songs.mk, so I wasn't aware that was even a thing. I tested it out, and it worked like a charm. I'll add what I've learned to the tutorial.
     
    10
    Posts
    9
    Years
    • Seen Jul 4, 2023
    Can you share your voicegroupmidi.inc? This tutorial works wonders when adding your songs but I can't seem to work my head around the voicegroups part. I wanted to know if I could use your voicegroup file for the custom songs you have.
     
    247
    Posts
    6
    Years
    • Seen today
    Can you share your voicegroupmidi.inc? This tutorial works wonders when adding your songs but I can't seem to work my head around the voicegroups part. I wanted to know if I could use your voicegroup file for the custom songs you have.

    I can, but it's gonna require you to put a lot of work in to use it. My voicegroup is based on an earlier version of pokeemerald, which has several of the instruments having different names and parameters than the most up-to-date pokeemerald. I update the individual instruments when I put them into the VOICE legend of the .s file, but I prefer to stick with this older version of pokeemerald for my music hacking, so I don't update the instruments in my voicegroup. I also have added in all of my custom instruments into this voicegroup. That would mean you would have to download all of my custom instruments, implement them, and also change all of the improperly-named instruments so as to have them match your version of pokeemerald's requirements before you could even use my voicegroup. If you're up for that, I can post it, but if not, I could just create a stand-alone voicegroup for whatever song(s) you were wanting to add to your ROM hack.
     
    10
    Posts
    9
    Years
    • Seen Jul 4, 2023
    I can, but it's gonna require you to put a lot of work in to use it. My voicegroup is based on an earlier version of pokeemerald, which has several of the instruments having different names and parameters than the most up-to-date pokeemerald. I update the individual instruments when I put them into the VOICE legend of the .s file, but I prefer to stick with this older version of pokeemerald for my music hacking, so I don't update the instruments in my voicegroup. I also have added in all of my custom instruments into this voicegroup. That would mean you would have to download all of my custom instruments, implement them, and also change all of the improperly-named instruments so as to have them match your version of pokeemerald's requirements before you could even use my voicegroup. If you're up for that, I can post it, but if not, I could just create a stand-alone voicegroup for whatever song(s) you were wanting to add to your ROM hack.

    If you could create a stand-alone voicegroup that would be fine. There are five songs in the folder that I want to use and I pretty much have everything implemented for all 5 of them except the voicegroup.
     
    15
    Posts
    5
    Years
  • Neato tutorial! This helps me a lot. But I encounter some issues with mine. I stumbled some problems in making a full general percussion voicegroup. It seems to be shifted in some points, and the sample with no_resample in it still stretches.
    Also the carefully mapped custom clarinet seems off in its octave even declared its proper keynote.
    Lastly, do you think loading a full general bank/voicegroup (+general percussion) works fine in game? TYIA.
     
    247
    Posts
    6
    Years
    • Seen today
    It seems to be shifted in some points, and the sample with no_resample in it still stretches.
    Could you show me your percussion voicegroup? And what do you mean when you say no_resample "stretches"?
    Also the carefully mapped custom clarinet seems off in its octave even declared its proper keynote.
    That is correct. I just haven't gotten around to making a sample at the correct octave yet.
    Lastly, do you think loading a full general bank/voicegroup (+general percussion) works fine in game? TYIA.
    Yes. I always use my master voicegroup when I work on my songs, which has the instruments set at the same indexes as my midi-editing software. The only time I don't have a song use that voicegroup is when a song needs a very particular instrument that I won't usually use in other songs, like the choral "Ghetsis" voice in my Ghetsis Battle Theme transcription.
     
    15
    Posts
    5
    Years
  • Could you show me your percussion voicegroup? And what do you mean when you say no_resample "stretches"?

    I'm trying to add a sample below the kick drum. Then I used these pre-made music to test it.
    Here's the whole percussion voicegroup:
    Spoiler:


    (The percussion still haven't organized it totally).


    Then here's the sample dokidoki:

    View attachment sound_direct_sound_samples_voice_dokidoki.mp3

    Then here's the test in-game:
    (Those said issues all occured here).

    View attachment 2021-07-06_16-22-55.mp4
     
    247
    Posts
    6
    Years
    • Seen today

    If the issue is that the wrong instrument is being played when you're wanting your dokidoki sample being played, then the source of the problem is that you're playing the wrong note in your .s file. It should be Bn0, assuming I counted it correctly. If the issue is you just can't really hear the dokidoki sample when it plays, I'd suggest changing the "voice_directsound_no_resample" in your dokidoki sample to be "voice_directsound". This often makes the sample work better in general.

    The only way I could really figure out how to fix the problem would be if I saw the .s file for the song, along with the full voicegroup being used with this song.
     
    222
    Posts
    6
    Years
    • Seen Nov 18, 2023
    Quick question about changing the tracks and voice maximums... What kind of performance, memory, or quality decrease does this mean? Because nothing is free so I just want to know the caveats of increasing these values.
     
    247
    Posts
    6
    Years
    • Seen today
    Quick question about changing the tracks and voice maximums... What kind of performance, memory, or quality decrease does this mean? Because nothing is free so I just want to know the caveats of increasing these values.

    As of yet, I have not noticed any decreases in performance or quality. If you try to push the voice maximum beyond 12, there will be a severe dip in audio quality, and I wouldn't be surprised if the same were true for pushing the track maximum beyond 16. In terms of memory, more memory is allocated for the extra music tracks so that the extra tracks' data don't overflow into the sound effect tracks. I think it takes up something along the lines of 36 bytes? That is just a guess based upon the different between the original .space command's value and the new value, and it's a very uneducated guess at that. When increasing the voice maximum, though, I think we are just allowing the sound system of the ROM to fully utilize its potential. I'm sure more memory is being used when those extra notes are being played, but I can't say for certain how much memory, or if that's actually true.
     
    Last edited:

    Jessler

    PidgeyFox
    33
    Posts
    6
    Years
  • Hey! I'm an audio engineer so this is something I've been really excited about getting into. That being said, the voicegroups part is still a bit confusing to me. Could you elaborate a bit more on how you actually make a full voicegroup for a given midi file? I'm a bit confused as to how I'm supposed to pick out the individual instruments I want. I'd really appreciate it!
     
    Back
    Top