Difference between revisions of "Sound Replacement Tutorial"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
(Great guide, just updated for clarity. Thanks for the writeup.)
Line 1: Line 1:
{{todo|Cleanup.}}
+
These instructions should be relevant for Windows 7/10/11 users.<br>
 
 
First, make sure you have Python installed. Then, download [https://cdn.discordapp.com/attachments/301121846944727040/358295103019679764/Pikmin2SoundHelperScripts.zip Yoshi2's sound helper] and extract the contents to your root's AudioRes folder. Run create_workshop.py, and wait for it to finish extracting everything.<br>
 
 
<br>
 
<br>
In the waves folder are the extracted sounds, which you must replace with wavs that are at least very close in file size. It's reccomended that all your sounds are in mono, and are the same length and sample rate as the sounds they're replacing.<br>
+
First, make sure you have [https://www.digitalocean.com/community/tutorials/install-python-windows-10 Python installed]. Then, download [https://cdn.discordapp.com/attachments/301121846944727040/358295103019679764/Pikmin2SoundHelperScripts.zip Yoshi2's sound helper] and extract the contents to your root's <b>AudioRes</b> folder. You can use [https://gbatemp.net/download/gamecube-iso-tool.33956/ Gamecube ISO tool] to expose the game's file structure (additional info can be found in [https://pikmintkb.com/wiki/General_instructions General instructions]). Run <b>create_workshop.py</b>, and wait for it to finish extracting everything.<br>
 
<br>
 
<br>
To change the sample rate, go to Tracks>Resample in Audacity, and change the sample rate to whatever number you need it to be. Then, in the bottom rate, you should see a drop down called "Project Rate (Hz)". Change the number in that drop down to whatever sample rate you need the sound to be; it should be the same number you just used in resample.<br>
+
In the <b>waves</b> folder are the extracted sounds which you must replace with <b>.wav</b> 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.<br>
 
<br>
 
<br>
To change the track to mono, go to Tracks>Mix>Mix Stereo Down to Mono. Sometimes, the sound may already be at a good sample rate, and/or may already be in mono, so those steps aren't always needed.<br>
+
To change the sample rate, go to <b>Tracks</b> > <b>Resample...</b> in Audacity ([https://github.com/audacity/audacity/releases/download/Audacity-3.3.3/audacity-win-3.3.3-x64.exe Audacity 3.3.3]), and change the sample rate to match the existing sound file (ex. 22050 Hz). Next, click on the <b>Audio Setup</b> button and then <b>Audio Settings...</b> where you should see <b>Project Sample Rate.</b> 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 <b>Resample...</b>).<br>
 
<br>
 
<br>
You should also make sure your sound should be heard, in which case you should select the entire sound (Ctril+A) and do Effect>Amplify>OK.<br>
+
To change the track to mono, go to <b>Tracks</b> > <b>Mix</b> > <b>Mix Stereo Down to Mono</b>. If this option is greyed out then the track is already in mono.<br>
 
<br>
 
<br>
Finally, go to File>Export and then save it as a 16-bit PCM  wav. You should then replace the vanilla sound you want to replace with your edited sound. For an as-of-now incomplete list of which sound is which, go [[Guide_To_Sound_File_Names|here]]. Keep in mind the names of the sound files you are changing, because you'll need it for the next part.<br>
+
To modify the sound effect's volume, first click anywhere on the sound file and press <b>Ctrl + A</b>, then go to the toolbar and click on <b>Effect</b> > <b>Volume and Compression</b> > <b>Amplify</b> and modify the amplication (dB) desired. You can then click preview and apply.<br>
 
<br>
 
<br>
Next, go in the workshop folder and open wsys.xml in Notepad++. Find each sound you replaced, and do the following:<br>
+
Once finished, go to <b>File</b> > <b>Export</b> > <b>Export as WAV</b> and ensure the save as type is <b>WAV</b> and that encoding is set to <b>16-bit PCM</b>. Replace the vanilla sound <b>.wav</b> file with your edited sound. For a list of sounds in <b>wScene_0.aw</b>, go [[Guide_To_Sound_File_Names|here]]. Keep in mind the names of the sound files you are changing, as you will need it for the following steps.<br>
 
<br>
 
<br>
1) Replace the "repack" in the filepath with waves.<br>
+
Next, go in the workshop folder and open <b>wsys0.xml</b> in [https://notepad-plus-plus.org/downloads/ Notepad++].  Find each sound you replaced and do the following:<br>
 
<br>
 
<br>
2) Replace the ".raw" at the end of the sound file name with ".wav".<br>
+
1). Replace <b>\repack\</b> in the file path with <b>\waves\</b><br>
 
<br>
 
<br>
3) Remove the "rate=XXXXX " part. This will make the program automatically calculate the sound's sample rate when it repacks the sounds. If you don't do this, then the sound may be at the wrong pitch or speed in-game.<br>
+
2). Replace <b>.raw</b> at the end of the sound file name with <b>.wav</b><br>
 
<br>
 
<br>
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, go in Audacity, and at the bottom where it shows the current time the sound is at, click on the small arrow and change the units to samples instead of hh:mm:ss + milliseconds. Now, whenever you select a part of your sound in Audacity, you can see which sample point you are at, and thus it's much easier to make a custom loop.<br>
+
3). Remove <b>rate="XXXXX"</b>. 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<br>
 
<br>
 
<br>
Once you've done all that for each sound you've replaced, go back to the AudioRes folder and run rebuild_soundfiles.py. This script may take a while to execute, but once it's done, go in the newly created output folder. Copy every new aw file into AudioRes/banks, and copy PSound.aaf into the AudioRes folder itself.<br>
+
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 <b>hh:mm:ss + milliseconds</b>. 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<br>
 
<br>
 
<br>
After this, you can rebuild the iso, and if your wav files weren't too big before, then everything should work perfectly!
+
Once you've followed these steps for each sound you've replaced, go back to the <b>AudioRes</b> folder and run <b>rebuild_soundfiles.py</b>. Once the script is finished, open the newly created <b>output</b> folder. Copy every new <b>.aw</b> file into <b>AudioRes/banks</b>, and copy <b>PSound.aaf</b> into the <b>AudioRes</b> folder.<br>
 
+
<br>
[[Category:Notes]]
+
Finally you can save your <b>.iso</b> as trimmed using [https://gbatemp.net/download/gamecube-iso-tool.33956/ Gamecube ISO tool] and if your <b>.wav</b> files aren't too big then everything should work perfectly!

Revision as of 16:01, 9 July 2023

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!