• 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] [RESOURCE] NDS Music Expansion for Pokeemerald

CyanSMP64

Furret
13
Posts
4
Years
Pokeemerald Music Expansionby CyanSMP64 "Furret"

Update 03/11/2022: Music Expansion is being maintained again. Final releases are expected to be out by April in the form of a single commit. Sorry for any inconvenience the current version has in terms of conflicts.
  • The upcoming update can potentially save a few tens of thousands to hundreds of thousands of bytes by reducing the sample rates of some samples that lack any high end frequencies, while also increasing the sample rates of fewer samples with distinct high end frequencies to make playback at higher sample rates sound more crisp. For context, all samples in the current version were resampled to the default engine rate of 13,379 Hz.
  • Black 2/White 2 has been completed.
  • Complete overhaul of D/P/Pt and HG/SS is in progress.
Update 06/20/2022: After a much longer time than I anticipated, I'm almost ready to release an updated version.
However at the moment it's just gonna be DPPt+HGSS, no Gen V stuff as I have yet to polish them up like I did with Gen IV in the past couple of months. It took a lot longer than I expected (was initially targeting an April release) because there was just more things I wanted to do with it. Also I had a writer's block some time starting in late March after finding out that I had made a mistake in several Gen IV midis that I thought I had already polished up.
The release will come in the form of single commits in fresh new branches, for easier mergeability. For the time being I have removed the links to the branches for maintenance.


Update 10/20/2022: Please visit the #resources channel in the PRET Discord for the branch links. This thread is obsolete and I plan to move it.


These branches add music from Gen IV and Gen V games to the Pokeemerald decomps.

Features!
  • Music from DPPt, HGSS and BW, converted accurately to sound best in-game. B2W2 is planned!
  • NDS Soundfonts
  • HQ m4a mixer
  • 15 voice direct sound polyphony
  • Sound test menu accessible via the title screen by pressing the Right+Select+B button combination
  • Legendaries that appear in the wild will have their respective themes play instead of the default wild battle theme

Public Repository
Be sure to check how much space left you have in your ROM, because these can take up a lot of space.
As of 06/20/2022, the links have been removed for maintenance. See update notice above.
  • DPPt Music. (Requires 1671152 bytes (~1.59 MB) of free space.)
  • HGSS Music. (Requires 1435028 bytes (~1.37 MB) of free space.)
  • DPPt and HGSS Music. (Requires 2877024 bytes (~2.74 MB) of free space.)
  • BW Music. (Requires 3710592 bytes (~3.54 MB) of free space.)
  • HGSS and BW Music. (Requires 4619264 bytes (~4.41 MB) of free space.)
  • DPPt, HGSS and BW Music. (Requires 6009792 bytes (~5.73 MB) of free space.)
And for musicians looking to create their own music using the voicegroups, soundfonts in .sf2 format are available in the /sound/voicegroups directory!

Selection branches
  • DPPt, HGSS and BW (battle music only). (Requires 2165920 bytes (~2.07 MB) of free space.)

To-Do
  • Portamento implementation. Many Gen V tracks are notably lacking portamento, and I've pointed out which ones do so in the song list at /include/constants/songs.h.

Credits
  • Ipatix - HQ m4a mixer
  • Sierraffinity - Sound test menu ported from CrystalDust
  • Junichi Masuda, Go Ichinose, Morikazu Aoki, Hitomi Sato, Shota Kageyama, Takuto Kitsuta, Minako Adachi - Original compositions and arrangements
 
Last edited:
247
Posts
6
Years
  • Age 25
  • Seen yesterday
This is really impressive! How did you go about increasing direct sound polyphony beyond 12? I've looked over some of your code and seen some of the changes made, but I seem to be missing some critical changes, as my music still starts crackling and popping if I increase the direct sound limit to anything above 12.
 

CyanSMP64

Furret
13
Posts
4
Years
This is really impressive! How did you go about increasing direct sound polyphony beyond 12? I've looked over some of your code and seen some of the changes made, but I seem to be missing some critical changes, as my music still starts crackling and popping if I increase the direct sound limit to anything above 12.
This sounds like data overflowing into the PCM buffer and being looped by the game's reverb. To solve this, go to /src/m4a_1.s, Ctrl+F "0x350" and replace that with "0x410"
 
247
Posts
6
Years
  • Age 25
  • Seen yesterday
This sounds like data overflowing into the PCM buffer and being looped by the game's reverb. To solve this, go to /src/m4a_1.s, Ctrl+F "0x350" and replace that with "0x410"

When I search in src/m4a_1.s, there is no "0x350". I looked at pret's src/m4a_1.s and compared it with yours, and it looks like you added quite a bit of stuff, including that line that has "0x410". Are these changes simple enough to implement by just copying them over into my repository, or do I just need to copy over your file over to my repository and then slowly debug it until everything works smoothly?
 

CyanSMP64

Furret
13
Posts
4
Years
When I search in src/m4a_1.s, there is no "0x350". I looked at pret's src/m4a_1.s and compared it with yours, and it looks like you added quite a bit of stuff, including that line that has "0x410". Are these changes simple enough to implement by just copying them over into my repository, or do I just need to copy over your file over to my repository and then slowly debug it until everything works smoothly?
The mixer code comes from Ipatix's HQ m4a mixer. There's even a page on the pret wiki about how to implement it
 
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
This is an amazing resource, well done! It's incredible how accurate it is, I can't tell the difference between this on a GBA and the originals on DS.

Got a few questions though as I know next to nothing about music: What takes up most of the space? Would removing some tracks save a meaningful amount of space, or is it largely the voicegroups and soundfonts? If so, how would you remove a track?
 

CyanSMP64

Furret
13
Posts
4
Years
Got a few questions though as I know next to nothing about music: What takes up most of the space? Would removing some tracks save a meaningful amount of space, or is it largely the voicegroups and soundfonts? If so, how would you remove a track?

As for gen 4 stuff (DPPt+HGSS), the midis actually take up more space than all of the sound samples combined, at a ratio of about 5:4.
Gen 5 on the other hand is really quite sample-heavy, with a lot of samples, large ones especially, being used exclusively for one or very few songs. The five samples used in the Game Freak logo for example take up a total of 202436 bytes, and are never used anywhere else.

If you want to remove songs, delete the midi files and their references in songs.mk and ld_script.txt, then in /sound/song_table.inc replace what you deleted with mus_dummy. No need to remove the defines.

If you also want to remove associated direct sound samples, note that the following process is quite lengthy, so you probably don't want to do this. Instead you can just ask me about it by sending me a message here or on Discord at CyanSixFour#0064 (I'm more active on Discord). First, you would need to check which instruments were used in the midi. What I do is open up the midi in Sekaiju, go to the event list window and show only "Program Change" events. It should look something like this:
I6AaL1g.png

Now I know that it uses program numbers 60, 61, 62, 63 and 64. Go to where the midi is referenced in songs.mk, and look for the "-G[number]" on the line below. This is the number of which voice group the midi uses. In the /sound/voicegroups directory open up the corresponding file then go to the line numbers of the aforementioned program numbers, plus 3. In this case I will go to lines 63-67.
K39KRx3.png

These are the samples that are used in the Game Freak logo. I already know that these samples are not used anywhere else, but otherwise I would first check that they aren't used anywhere else, by searching for the sample name across every voice group. If this is the only voice group that uses it then you would have to thoroughly search other songs that use the same voice group and check that none of them use the same program numbers. Once this is done you can go and delete the sample entry from /sound/direct_sound_data.inc, and replace each voice group entry you won't use with the placeholder entry "voice_square_1 60, 0, 0, 2, 0, 0, 15, 0".

You might also see "voice_keysplit voicegroup[number], KeySplitTable[number]" in which case you would instead search for the "voicegroup[number]" to see if any other voice groups use that key split.
You probably don't need to go through this sample cutting process with anything from gen 4 or any sample that begins with "DirectSoundWavaData_dp_" or "DirectSoundWavaData_hg_".
 
Last edited:
1,591
Posts
10
Years
  • Age 30
  • Seen Mar 20, 2024
Spoiler:

Thanks for the detailed answers! Will message you if I get to the point where removing samples is necessary (might remove the Game Freak logo samples anyway).
 

CyanSMP64

Furret
13
Posts
4
Years
Just updated the branches. There had been crash reports from players of Inclement Emerald, and it turns out I missed an important part of the upgraded mixer implementation so now there shouldn't be any crashes.

Also added a new selection branch in case anyone wants to save space by only including the battle music of Gen 4 and BW.
 
Back
Top