Replacing SFX

Disclaimer
Full credits go to John10v10 and his Video Replacing SFX in NSMBw for showcasing How to replace SFX in NSMBWii. I'm just writing that tutorial down in the wiki. Now let's start!

Choosing the sound to replace


This is the directory we start with: a copy of NSMBWii's brsar and the sound we want to place in.

The first thing we're gonna do is open the .brsar file in BrawlCrate or BrawlBox.



There we can see the scroll bar on the right bottom site of the window. Use that and scroll down until you get to the entry with the index 85 and the file GROUP/BOOT immediately after the entry of stream/BGM_HIKOUSEN_ROUKA_fast.32.brstm. Right click that entry and choose export and export it to your folder. You will now have a GROUP_BOOT.brwsd file. This file stores the SFX for NSMBWii. We now open GROUP_BOOT.brwsd in BrawlCrate/BrawlBox.



You can see one file and one folder. Expand the Audio file. You can see many files named Audio[xxx]. Those are the sound clips played in NSMBWii. For this tutorial we choose voice clip Audio[112].

This clip plays when the player riding Yoshi gets hit by an enemy.



Right click Audio[112] and export it as .rwav file. Now that we have our file we want to replace let's move on to step two.

Creating Compatible SFX
Now let's start creating our sound clip we want to put into the game. First choose whatever sound clip you want and open it in Audacity or any other audio editing software you can work with.



As you can see in our example the level entry sound from Super Mario 3D World is a stereo sound with 32000 sound samples and a total length of about 2.5 seconds.

'''Edit (thanks to CLF78 for mentioning) The below part (the one with the rules considering the length and sample rate) is wrong. Your song has to have the same sample rate or a lower sample rate as the original one. If you lower the sample rate of your clip you can have a longer duration than the original one. The false parts have (hopefully) been removed.'''

Now here comes the important part. In order to create a valid sound clip you have to follow these rules:

In our case the sound we use already has a sample rate of 32000 and we will just leave it like that. But if you lower your sample rate (see below) than your audio clip can actually have a longer duration.
 * The maximum sample rate of our sound clip can only be the sample rate of the original sound clip or lower than that.



In order to lower you sample rate in Audacity just use the drop down mask in the bottom left corner of your window and choose 32000 or anything lower.

In our case the sound is a stereo channel clip. In order to make it a mono channel clip follow the next step. If you already have a mono channel clip then you can skip it.
 * Your clip has to be a mono channel clip not a stereo type.



In order to make your clip a mono channel go to Mask and choose the mono sound option.

If you use a file bigger than the one you want to replace then the replacement won't work and the .brsar gets corrupted.
 * You filesize has to be lower or equal the size of the clip you want to replace.

Now after following all these steps correctly we save our edited file as normal .wav and move on to the next step.

Convert from WAV to RWAV
First things first: You should know that the sound clips in the bsrar are stored as RWAV files. In order to get one follow the next steps.



The first thing you do is to open GROUP_BOOT.brwsd in BrawlCrate/BrawlBox again. There you once again scroll down to the sound you want to remove (in our case Audio[112]). Now you right click Audio[112] and press replace. Then you choose your edited file and import it.

You have the choice to either loop it or not. In this tutorial we check both loop checkboxes (on the top and on the bottom of the window). Then you hit okay and you will see your new clip in your file.



Now you choose your newly imported file and export it as .rwav file.

Finally we came to the last step of this tutorial.

Insert Sound in BRSAR
In order to insert your new sound into the brsar we need a hex editor. In this tutorial I use the HxD Hex Editor. Open up your brsar, the original voice clip Audio[112] we exported earlier and the new voice clip Audio[112]NEW.rwav we created in the hex editor.



Now go to Audio[112] select the last bytes of the file, go to the brsar and search for those bytes.



Important: Remeber the offset of the next RWAV Header, in this case 0x15BF80

When you found them mark them and move up until you get to the header of the sound labeled with RWAV. Now you have selected the whole original sound.

Switch to your custom sound select all bytes in the file, go to the brsar and paste your copied bytes over the selected ones. As you will see, if your file was smaller than the original, the whole brsar file shrunk and the offsets of all headers moved to different places than before. If we leave it like that the brsar gets corrupted and won't work. What we need to do is to insert so many bytes untl we reach we original size of the file. In our case we remembered the offset of the header 0x15BF80.



So we insert bytes until we reach that original offset from before. When we successfully reached the offset we're finally finished. Now save the brsar and have fun with your custom sound!

Example of this Tutorial
Here you can see a video showing of the custom sound I inserted in this tutorial. See Tutorial: Replace SFX in NSMBWii