• 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 2, 2024
    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!

    Before you make a voicegroup for a given midi file, I'd suggest making a master voicegroup instead, which can be used for every song. I've found it to be far easier than making a new voicegroup for every single song added. But I realize some songs may need rather unique instruments that you wouldn't normally put in a master voicegroup, so there are still situations where you'll want to make a unique voicegroup for one song.

    1. Make sure you know all of the instruments you want for the song. This may seem obvious to do, but sometimes I've forgotten that I needed this one weird woodwind or something after I've started testing the song, so it's worth stating.

    2. Look through sound/direct_sound_samples and see if all of the instruments you want for the song are in there or not. If some aren't, you'll need to add those instruments yourself. This can be kind of tedious, since there are a lot of samples in there, but it's the only way to know for certain if the ROM already has what you're looking for. You can try searching for the name of the instrument that you want via whatever file search methods you have at your disposal, but sometimes the instruments can be under weird names that make sense when you find them, but you wouldn't have guessed their names initially.

    3. Once you're sure you have all of the instrument samples that you'll need, go to sound/voicegroups and create a new .inc file (just create a .txt file and change the extension. Ignore the warning, and move on), name it voicegroup### with some unique number, and open the file in the text editor of your choice. If you have an older version of pokeemerald without the sound/voicegroups folder, you'll instead just open sound/voice_groups.inc for this step.

    4. Once in your voicegroup file, at the very top, write this:
    Code:
    	.align 2
    voicegroup###::
    Again, use your chosen number instead of those hashtags/pound signs/octothorpes/whatevers. If your in sound/voice_groups.inc, then just scroll to the bottom of the file and write the same thing beneath the last voicegroup in the file.

    5. For all of the rest of the lines, you'll be adding your instrument samples. Each voice has it's own line, and starts with one of these:
    Code:
    voice_square_1
    voice_square_1_alt
    voice_square_2
    voice_square_2_alt
    voice_programmable_wave
    voice_programmable_wave_alt
    voice_directsound
    voice_directsound_alt
    voice_directsound_no_resample
    voice_keysplit
    voice_keysplit_all
    Hopefully I didn't miss any. You'll usually just be using voice_directsound anyway.

    6. Then you write 60, 0,. These values supposedly relate to the midi_key and pan values, meaning the first number determines what the unadjusted pitch of the sample for this voice is (60 = Cn3), and the second number represents if the sound of this voice is coming more out of the left or right speaker (0 = center). I've messed with these numbers and haven't heard any changes, but maybe there's a trick to them that I don't get. If you are using a keysplit voice, however, you will instead write the voicegroup that you are splitting, and then, if you aren't using keysplit_all, the keysplit table you are applying to this split. Then that voice is done. If you aren't using a keysplit voice, move on to the next step.

    7. Then, depending on which type of voice you're writing, you'll either write the name of your instrument sample (directsound), the name of your wave sample (programmable_wave), duty cycle (square_2), or sweep and then duty cycle (square_1).

    8. Then comes the voice envelopes. Attack, decay, sustain, release. I've described what these do in the tutorial, so I won't describe it here.

    9. Repeat steps 5-8 until you have added all of the voices you need to your voicegroup.

    Hopefully that clears some things up. If something is still confusing, let me know.
     

    Jessler

    PidgeyFox
    33
    Posts
    6
    Years
  • I hate to bug you again, but now I'm having a separate issue. There's a really strange crackling noise in my song, and I can't seem to figure out how to get rid of it. Do you have any ideas? I can provide the files if needed.
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    I hate to bug you again, but now I'm having a separate issue. There's a really strange crackling noise in my song, and I can't seem to figure out how to get rid of it. Do you have any ideas? I can provide the files if needed.

    Taking a random stab at the issue, if a song is too loud, it can start to make crackling sounds. Any more accurate help would require me to see the .s file, the voicegroup, and any custom voice samples used with the song.
     

    Jessler

    PidgeyFox
    33
    Posts
    6
    Years
  • Taking a random stab at the issue, if a song is too loud, it can start to make crackling sounds.

    Ah, yep. That did it, thanks! That's interesting that it would crackle like that. I suppose the game's sound engine mixes it similarly to how I'd mix a song on a console or in Pro Tools. Do you know of any resources I could use to learn more about the mixer? Sorry for geeking out- this stuff is pretty fascinating to me ^.^
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Ah, yep. That did it, thanks! That's interesting that it would crackle like that. I suppose the game's sound engine mixes it similarly to how I'd mix a song on a console or in Pro Tools. Do you know of any resources I could use to learn more about the mixer? Sorry for geeking out- this stuff is pretty fascinating to me ^.^

    You may be able to glean some knowledge from this tutorial. It helps you upgrade pokeemerald's mixer. I've yet to take a real dive into it myself, but I know it can remove a lot of the limitations of pokeemerald's sound system.
     
    2
    Posts
    2
    Years
    • Seen Nov 24, 2021
    Hey, would you be willing to share your General Midi voicegroup?
    Really appreciate the guide, still struggling with actual conforming the midi but getting there!
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Hey, would you be willing to share your General Midi voicegroup?

    Sure! I will say that I do most of my music work on an older version of pokeemerald, so you'll need to make some small adjustments to a lot of the voices in this voicegroup to make it fit the updated formatting. There are also several custom voices that I've added, so you'll either need to add those samples yourself, or swap it out with a dummy voice.

    General Voicegroup
    Spoiler:
    Really appreciate the guide, still struggling with actual conforming the midi but getting there!

    If you need any help with that, you can post the specific issues that you're having, and I'll see if I can help!
     
    2
    Posts
    2
    Years
    • Seen Nov 24, 2021
    Awesome, thank you so much!

    It's mostly just triyng to get the midi to conform to midi2agb using reaper, I think I'm sorted now though.

    Thanks again!
     

    Sierraffinity

    Desperately trying to retire from ROM hacking
    1,069
    Posts
    16
    Years
  • Hi, just want to let you know that following the steps in the "Limitations of the GBA (And How to Get Past Some of Them)" section will cause you to use 0x1E0 more bytes in IWRAM, and has the potential for IWRAM data to run into the stack space and cause random glitches and crashes. To use this safely, you need to free up some data in IWRAM; installing ipatix's sound mixer will take care of that for you.
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Hi, just want to let you know that following the steps in the "Limitations of the GBA (And How to Get Past Some of Them)" section will cause you to use 0x1E0 more bytes in IWRAM, and has the potential for IWRAM data to run into the stack space and cause random glitches and crashes. To use this safely, you need to free up some data in IWRAM; installing ipatix's sound mixer will take care of that for you.

    Thanks for pointing that out! I'll add that information to that section.
     
    53
    Posts
    8
    Years
    • Seen Aug 25, 2023
    Sadly adding songs is easy. Getting them to sound good not so much. I can easily add All Star. Making it sound good is another issue all together. Regardless good tutorial on at least adding songs.
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Sadly adding songs is easy. Getting them to sound good not so much. I can easily add All Star. Making it sound good is another issue all together. Regardless good tutorial on at least adding songs.

    Yeah, getting songs to play nice on GBA isn't always simple. Depending on the song, you might need to work on mixing the instruments differently, changing instruments, change samples, or even altering the actual melody or percussion of a given track. It's gonna vary depending on what song you use, so there's no way to make a tutorial for something like that, other than a more generic mixing tutorial for music overall.
     
    53
    Posts
    8
    Years
    • Seen Aug 25, 2023
    Sad but true, unless you are able to hire a musician or are good at sound mixing midis yourself + understanding how the GBA sound works most will have to use the normal RSE and FRLG music.
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Is there a way you can replace or add your song as a trainers theme?

    Yup! If you read the "How to Add a New Song To Your ROM" section of the main post of this thread, I've written the process for both replacing a song as well as adding a brand new song to the ROM.
     
    56
    Posts
    8
    Years
  • Hi! First of all, thanks so much for the tutorial, I've been working on the music of my game for a few weeks with it now and it's been great to learn how to do everything in order to make it sound good ^^

    I have one doubt though, you recommend to edit the .s files (or at least it seems you prefer that), but I've read (and I guess why) that's a bad idea. I opted for that as well, as I could achieve what I wanted with my songs (and to be honest there's things I don't know how to do with Anvil Studio). The thing is, if you once do "make clean", that work obviously disappears, so then you have to save the .s files and replace them everytime you do so. I've tried to see if there's any way to turn those .s files back to .mid format and work from there, but I have no clue, do you know something about it?

    As I say, my songs are fine now, but I couldn't get them to work the same way if I edited the .mid file instead of the .s one, so I'd be glad if you could answer, or maybe recommend another midi editor XD. Thank you in advance!
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    Hi! First of all, thanks so much for the tutorial, I've been working on the music of my game for a few weeks with it now and it's been great to learn how to do everything in order to make it sound good ^^

    I have one doubt though, you recommend to edit the .s files (or at least it seems you prefer that), but I've read (and I guess why) that's a bad idea. I opted for that as well, as I could achieve what I wanted with my songs (and to be honest there's things I don't know how to do with Anvil Studio). The thing is, if you once do "make clean", that work obviously disappears, so then you have to save the .s files and replace them everytime you do so. I've tried to see if there's any way to turn those .s files back to .mid format and work from there, but I have no clue, do you know something about it?

    As I say, my songs are fine now, but I couldn't get them to work the same way if I edited the .mid file instead of the .s one, so I'd be glad if you could answer, or maybe recommend another midi editor XD. Thank you in advance!

    I've run into that issue myself. As of yet, I haven't been able to convert .s back into .mid. However, I have learned a few tricks to improve using midi editors to get what I would usually be able to get through the .s file, due to working on some music for someone else's project. I still definitely prefer working with the .s, but sometimes it's necessary to get the stuff in the .mid. I've been wanting to add that stuff to this tutorial, but I haven't had a ton of time to do much on this site other than answer a question here or there.

    I am curious to learn if there is a way to have make clean not delete the .s files within sound/songs/midi. If it's possible to somehow change that, and also not mess up anything else by doing so, that could be a different fix to the problem. Just a thought. I'm not nearly well-versed enough in that field to even attempt that.
     
    56
    Posts
    8
    Years

  • It's quite easy to do so, you just have to remove line 262 on the Makefile. To be honest I don't know if I want to do this, as I don't really know the consequences of doing it (or if I'm missing anything else), but if you wanna give it a try there it is. Just tested, did make clean and the s. files on the midi folder are still there

    YsGgTQ8.png


    I'll keep looking for an alternative, meanwhile I guess we can try this
     
    247
    Posts
    6
    Years
    • Seen May 2, 2024
    It's quite easy to do so, you just have to remove line 262 on the Makefile.......

    Nice find! I might mess around with that and see if everything runs smoothly. Obviously, being able to convert the .s back into .mid would be preferable, but this ain't half bad. I would think reversing the .mid → .s process would be possible, since the source code for mid2agb is in the tools folder. It would be pretty tedious, to be sure, but doable. Again, unless something changes, I wouldn't have the time to actually pursue that idea.
     
    Back
    Top