Sound Replacement Tutorial
Want to change a sound effect in Pikmin 2? Want to add an entirely new sound?
Well, you've come to the right place, even if the latter is more work.
Before any editing can be done, get Xayr's toolkit.
As far as I know, it only works with Windows.
From this page, select the most recent version, and download the Pikmin 2 zip.
After extracting that, you'll need to get the Banks folder from Pikmin 2, as well as the .aaf file.
Both can be found in the AudioRes folder of an extracted Pikmin 2 root.
Once everything is in the tool's folder, simply run the initialize.bat. file.
Once it finishes, there should be an Audio_Modding folder present.
Inside it, the 0 folder has all the actual wave data, while the IBNK0-5 folders have instrument playback data.
There is also a SoundTable folder, which matters if you're adding an entirely new sound.
If your goal is only to replace a sound file, your first goal should be to find the sound in the wav folder.
Until we have more proper documentation, this will take a lot of trial and error, although everything before 580 is exclusively music instruments.
Once you know the ID of the sound you want to replace, put a new .wav file with the same name in the 0/custom folder.
If you know what you're doing with another game that also uses these sound systems (Pikmin 1, mario sunshine), you may be able to save some memory by taking the .adp
directly from that game, and replacing the .adp in the 0/ref folder with your sound. This is because the .adp files use a better encoding than what can be done with
regular .wav files. I only recommend trying this if you're experienced with using Xayr's tools in multiple games and really need the memory savings.
Once you're satisfied with the new sound effects, go back to the tool's root folder, and run the rebuild_aaf.bat file.
It can take a while, but once it finishes, the Banks folder and PSound.aaf should be updated with the new contents.
Simply copy them back into your extracted game root, and you should be good to go!
If you do everything right, and music is completely silent in-game, you most likely made wScene_0.aw too big. In the standard game, it can only afford to be a bit larger
normal without problems arising, especially in challenge mode, where the key collected theme needs to load as well.
Adding entirely new sounds
Just changing normal sounds not good enough? Well get ready, because this is where things get complicated.
First, on top of the Xayr toolkit, you'll need NerduMiner's se.bms tools.
Keep it outside of Xayr's tools. Next, extract seq.arc from Pikmin 2, and put its se.bms file into the tool's folder.
You'll need a special info file as well, which isn't part of the tools release.
Once both se.bms and the info file are in the tool's folder, you should be good to drag the se.bms onto build.bat.
It will generate a .txt file, which we will use later.
Now that the other tool is set up, take your all new .wav file, and put it in the custom folder. Make sure it's name is an ID that isn't used at all normally. The first free ID in Pikmin 2 is 1423.wav.
Next, you'll need to edit the wavetable.json, which is located in the 0 folder.
Go to the bottom of it, and copy paste the final entry, which should be "265".
Make your new entry have 1423, or whatever your new wave ID is as its name.
It's important that you know the sample rate and sample count of your custom sound. Something like Audacity can tell you this. (The outdated section actually explains this well).
Make sure they are correct in your new entry. Other than that, you probably don't want to touch the other values in the new entry.
Next, enter the 0/scenes folder, and open wScene_0.aw.json file. At the end of it's very long list of wave IDs, add the ID of your new wave.
The last ID is 1410, normally. As is the case with json files, make sure you add a comma to 1410 after adding a new entry after it.
Next, exit the 0 folder, and go into IBNK0/include. You could technically use any of the banks, or even add an all new one. But this bank has the most
free spots, and it saves se.bms math later. Adding an all new one, while organized, can be complicated. We need to add a new instrument here, but we need an ID that isn't used yet.
2, 4, 5, 6, 9, 10, 11, and 12 are all free, for example. Copy and paste Inst_1.json, and make it named the ID if your new instrument. For example, Your first new sound will probably use Inst_2.json.
Open the json, and scroll to the bottom, there should be a single instance of a "WaveID", which you must change to the ID of the new sound effect you added earlier.
Now, go back to the IBNK0 folder, and open ibnk.json. You should see a list of all the used json files, make a copy of the first entry, for Inst_1, and make it say Inst_2, change the "1" in quotes at the beginning as well.
With this, the instrument data should be all good to go.
(The rest of this is exclusively for sound effects, if you're adding an all new actual music instrument, you wouldn't need to do this)
Next, exit the 0 folder, and go into the SoundTable/includes folder.
It should have json files called 0x1, 0x2, and so on. These represent different categories of sounds.
Each one has data for a variety of sound effects, 0x6 has by far the most, because it's for the enemies.
Everything you need to know about this part of the data can be found at this page.
The category your new sound goes into usually doesn't matter much, but there are some niche situations where it matters.
For example, during the start of Day 1 cutscene, Pikmin sounds are muted, and wont play until the first text box, when sounds in other categories still do.
For this example, we will add a new sound to the enemy category, so open 0x6.json. Adding sounds to the other categories may be problematic, because you would have to fix the "entryNumCategory" for everything in the later jsons.
First, there's a total entry count at the top of the file, increase this by 1.
Now, scroll all the way to the bottom of the json, and copy paste the last entry. By default, it should have 1037 for it's "entryNumCategory".
"entryNumCategory", "entryNum", and "entryNumGlobal" all need their values increased by exactly 1. The other values in it mostly don't matter,
although I think "type" may have some control over the sounds priority, which can lead to other sounds not playing. I'm not fully sure how this works yet.
Once this is done, 0x6.json should be good to go.
The final step is to fix the se.bms.txt we made earlier. You'll want to consult this page again to see how this file works.
As of writing this, it doesn't have much for the enemy category, though.
After opening the .txt, search for "@JUMPTABLE_60628h". This is the final sound in the normal game's jumptable for enemy sounds. The @ at the start is important, don't confuse the table entry with the data itself.
Copy the "@JUMPTABLE_60628h" line, and make a duplicate right after it. It needs a different name, so you might as well name it something logical, like "@JUMPTABLE_NEWSOUND". This will make it easier to keep track of.
Now, search for "JUMPTABLE_60628h" again, and find the second instance of it, there should be a : at the end, and no @.
We want to add a new entry immediately before it, just after the "return 0b" line preceding it.
Copy paste the following text in, replacing NEWSOUND with whatever you call the new sound (keep in mind every new sound needs a unique ID):
opentrack 0b @TRACK_0_START_NEWSOUND
call 0b @CALL_415h
param_set_16 6b 0h
noteon 64b 8b 127b 100b 0b
The final step is to make the param_set_16 line end in the ID of your new instrument. Note I said instrument (as in what was used for the IBNK0 folder), not the actual wave ID.
The ID of the bank itself is important as well, but if you used Bank ID 0, it doesn't matter. Just make it have the ID of the new instrument you added. For example, for Inst_2 in IBNK0,
the line would look like:
param_set_16 6b 2h
Don't touch the 6b part, or anything else here, besides the sound entry name.
Now, simply drag the se.bms.txt onto build.bat, and if it built correctly (make sure your new se.bms isn't 0kb), and put the new se.bms into the seq.arc archive.
Make sure you rebuild the .aaf and Banks folder with Xayr's tools, same as with replacing normal sounds.
Now we need to tell the game where to actually use the new sound. This can be complicated if you aren't knowledgeable with code editing. Luckily, new enemy sounds can be played with only edits to the AudioRes/key.arc file.
I'll explain how to use key.arc sounds for the sake of this tutorial, but if you wanted new sounds for something other than enemies, you'll need
some code edits (with the exception of cutscene sound effects, but .stb is a whole mess of its own).
First, extract key.arc, and go into the folder of your enemy of choice. There should be a .bas file for every animation, more or less.
Xayr has a tool for editing these files as well, which you should probably use. Simply drag a .bas onto the tool .exe and you should get a new .json.
You can add or remove specific sounds to play through an animation; SoundID is what sound to play, and FrameDelay is when in the animation it should play.
Knowing the actual ID of your new sound can be a pain, the enemy category normally ends at 22923, so the first new entry is 22924, and so on from there.
If you're using a different category than the enemy one, you can use this page to see the final normal ID of each category.
Once that's all done, you can drag the .json onto the bas tool and get a new .bas file, put it back in the enemy's folder, and rebuild key.arc.
At long last, you're ready to put everything together. Put the key.arc, seq.arc, pSound.aaf, and Banks folder all back into AudioRes.
If the stars happen to align, and everything miraculously works perfect, you should hear the new sound play in-game, when your enemy does the animation you changed the .bas for.
Do let me know if you have trouble with this, or if this guide is missing anything. - PikHacker
The remainder of this page is very outdated, but I will leave it here for posterity. I highly recommend using the above guide instead.
This tutorial is designed to help you replace or mute sound files in Pikmin 2. These instructions should be relevant for Windows 7/10/11 users.
First, make sure you have Python installed. Then, download Yoshi2's sound helper and extract the contents to your root's AudioRes folder. You can use Gamecube ISO tool to expose the game's file structure (additional info can be found in General instructions). Run create_workshop.py, and wait for it to finish extracting everything.
In the waves folder are the extracted sounds which you must replace with .wav files that are at least very close in file size. It's recommended that all your sounds are in mono the same length and sample rate as the sounds they're replacing.
To change the sample rate, go to Tracks > Resample... in Audacity (Audacity 3.3.3), and change the sample rate to match the existing sound file (ex. 22050 Hz). Next, click on the Audio Setup button and then Audio Settings... where you should see Project Sample Rate. You should change this number to the sample rate you need the sound to be (it should be the same number you just used in Resample...).
To change the track to mono, go to Tracks > Mix > Mix Stereo Down to Mono. If this option is greyed out then the track is already in mono.
To modify the sound effect's volume, first click anywhere on the sound file and press Ctrl + A, then go to the toolbar and click on Effect > Volume and Compression > Amplify and modify the amplication (dB) desired. You can then click preview and apply.
Once finished, go to File > Export > Export as WAV and ensure the save as type is WAV and that encoding is set to 16-bit PCM. Replace the vanilla sound .wav file with your edited sound. For a list of sounds in wScene_0.aw, go here. Keep in mind the names of the sound files you are changing, as you will need it for the following steps.
Next, go in the workshop folder and open wsys0.xml in Notepad++. Find each sound you replaced and do the following:
1). Replace \repack\ in the file path with \waves\
2). Replace .raw at the end of the sound file name with .wav
3). Remove rate="XXXXX". This will make the program automatically calculate the sound's sample rate when it repacks the sounds. If you don't remove this, then the sound may be at the wrong pitch or speed in-game
4). Certain sounds have a "loop point" that you can change. If you needed to make one of your sounds longer than the sound it's replacing, you should change this. To help determine which sample count you want it to loop at, open the sound file in Audacity, and at the bottom where it shows the current time the sound is at, click on the small down arrow at the end and change it to hh:mm:ss + milliseconds. Now whenever you select a part of your sound in Audacity, you can see which sample point you are at which should make it much easier to create a custom loop
Once you've followed these steps for each sound you've replaced, go back to the AudioRes folder and run rebuild_soundfiles.py. Once the script is finished, open the newly created output folder. Copy every new .aw file into AudioRes/banks, and copy PSound.aaf into the AudioRes folder.
Finally you can save your .iso as trimmed using Gamecube ISO tool and if your .wav files aren't too big then everything should work perfectly!