Importing custom music is one of the easiest types of mods, as it simply involves taking any song and converting it to a format that the game can read. New Super Mario Bros. Wii makes use of the BRSTM format, which is also used by several other Nintendo games. BRSTM files also support more than two channels, allowing for multiple tracks in one file. These additional tracks are mostly used for Yoshi Drums, with a few exceptions (which you can find at the bottom of this page).
Preparing for the Conversion
Open Audacity. Before importing anything, there's a couple of settings that should be changed. First, on the toolbar at the bottom, change Selection Start, Selection End and Audio Position to Samples. This is important for the later steps.
Secondly, press Edit > Preferences. In the window that opens, choose Import/Export and change the option When exporting tracks to an audio file to Use custom mix. This is fundamental if you want to export files with more than two channels.
You can now import your music files. To do so, press File > Import > Audio. Please note that you don't need to import the same track multiple times to put it in different channels.
First, apply the Normalize effect by pressing Effect > Normalize. This will make the audio as loud as possible (roughly similar to the original game's volume) without causing distortions and fixing any volume discrepancy between the two channels in the process. In the dialog that opens, leave the settings as default and press OK. Below is the difference before and after applying the effect:
If you need to make further improvements to the audio, such as cuts or tempo changes, do them before proceeding to the next section. If the audio quality is poor, you can find some tips to improve it here.
Finding the Loop
Please note that not every song needs a loop (you can find this information here). If this is the case, skip to the next section.
A loop is a section of the song that replays over and over, preventing it from ending too early and leaving the game without background music. The loop is defined by two points, the start point and the end point. To find a loop, listen to the song very carefully, until you find a portion that can be looped seamlessly. This is easier when using videogame music, as it is already intended to be looped. Below is an example:
As you can see from the image, the sound in the circled areas are similar, which hints at possible loop points. Further tips on this topic can be found here. Once you have found a suitable loop, click on the start point and press Tracks > Add Label at Selection. Name the label whatever you want, then look at the number of samples in Audio Position and write it down. Repeat for the end point.
Exporting the Song
You can export the audio by pressing File > Export Audio. In the window that opens, choose WAV (Microsoft) signed 16-bit PCM as the format, as it's the only one supported by BrawlBox.
If your song has only two channels, simply press OK in the window that opens and skip to the next paragraph.
The next step allows you to assign each audio stream to one or multiple channels. First, choose the amount of channels with the slider at the bottom. Now click on one of the streams (you can see it is selected due to the red outline), then click on a channel to assign the stream to it. Afterwards, click on both to deselect them. Repeat this for every stream. As a rule of thumb, assign the streams marked with L (left) to channels with odd numbers and the ones marked as R (right) to even-numbered channels.
Once you are done, press OK to save the file.
Creating the Fast Variant
If you already have the BRSTM ready and you're lazy, see this alternative method. Additionally, not all songs have a faster variant (see here for a list); if this is the case, skip to the next section.
For the faster version of the song, which is played when the timer is running low, you can either choose an entirely new song or speed up the normal one. To do the latter, press CTRL+A, then click on Effect > Sliding Stretch. In the window that opens, type the percentage you want to speed up by in both Initial Tempo Change and Final Tempo Change (if the percentages are different, the speed will change gradually). Do this for the pitch as well, if you want to. If you want to follow Nintendo's standard, do not change the pitch and use a value of 15. Press the Preview button to preview the effect, and once you're satisfied, press OK to apply the change. This procedure will take a while, but will guarantee the least quality loss.
As you might have noticed, the labels (and therefore the loop points) have moved. Click again on each label and write down the new Audio Position values, which will serve as loop points for the faster variant. You can now export the modified song as a second WAV file (pay attention not to overwrite the first one).
Converting to BRSTM
It is finally time to convert the song(s) to a format that the game can read. Open BRSTM Encoder and press Open WAV.
Choose a WAV file exported earlier on. If you want the song to loop, make sure that the Looped? tickbox on the right is enabled, otherwise disable it. Afterwards, insert the loop start and end points that you had written down before in their respective fields. Once you are ready, press Convert to convert the song to BRSTM.
Save the file and repeat these steps for the faster variant, if present. It is recommended to save the file with the same name as the one that will be replaced, the full list can be found here.
Patching the BRSAR
If you're replacing a sound file not present in the original game (such as the ones in Newer Super Mario Bros. Wii), you don't need to follow this section.
The final step is to patch the game's BRSAR (which you can find in the sound folder). This file, other than containing all the game's sound effects, manages the loop points and maximum size for all the BRSTM files in the game. If this file isn't updated, the new songs will cut off.
Proceed by placing the BRSAR Patcher in a folder together with the BRSAR and all the BRSTMs that you want to patch (make sure they have the same name as the files they will replace, see here for those). Run Patch.bat to apply the patch and wait until the process is completed, then press any button to close the window.