[Tutorial] How to replace the starman music in Mario Kart 8

Discussion in 'Wii U - Tutorials' started by EzioisAwesome56, Jul 25, 2017.

  1. EzioisAwesome56

    EzioisAwesome56 Newbie

    Jul 25, 2017
    United States
    yesterday I was screwing around with tools and hex editing and found out how to replace the starman music from mario kart 8, located in the file /vol/content/audio/turbo_sound.bfsar
    (this tutorial was written with windows in mind)
    NOTE: This was preformed with a dump of Mario Kart 8 USA. I dont know if this works for other regions

    Step 1
    . First, you are going to open vgmtoolbox, then on the right side, click "misc tools->Extraction tools->Generic->Advanced Cutter/Offset. A menu should appear on the right part of the window. in the drop down box with a "load" button under it, select "Nintendo Wii U - FWAV Streams" (if it doesnt show up, you didnt install the advanced cutter plugin) and then click load. A box should appear telling you its for use with some other format. Then drag your "turbo_sound.bfsar" into the "file to search" box to the left of the preset box. It will start splitting the file into parts for each .bfwav. once a message appears in the bottom white box, its done. you can move onto step 2.
    Selecting advanced cutter
    Warning: Spoilers inside!
    Loading Wii u fwav preset
    Warning: Spoilers inside!
    Where to drag the file
    Warning: Spoilers inside!

    Step 2. okay, so if everything went well in vgmtoolbox, there should be a new folder in the same place that the "turbo_sound.bsfar" file you dragged into vgmtoolbox that is called "turbo_sound_CUT". Inside that folder is a lot of .bfwavs. You need to find "turbo_sound_00000003.bfwav". This should be the starman theme. you can play it in foobar2000 to double check. You can delete all of the other bfwavs, all we are going to need is "turbo_sound_00000003.bfwav". It'll be handy for injecting later. Anyway, if you open its properties window, you should see its filesize is 214kb and is 22 seconds long. your new file has to be equal or less then that size, and exactly 22 seconds long, otherwise you might overwrite other things in turbo_sound.bfsar. You can move onto step 2: creating a .brstm to convert into .bfwav
    The cut output folder
    Warning: Spoilers inside!
    The bfwav we are going to need
    Warning: Spoilers inside!

    Step 3. Im going to assume you have already created a mp3 (wavs dont work for some reason) in audacity or whatever that is smaller then 214kb and is 22 seconds long. at this stage, you want to make the file as small as you can, as for whatever reason when you convert it into a brstm it gets way bigger. You can make it smaller by lowering the project rate in audacity and lowering the export bitrate. Be warned though, lowering the bitrate makes the output sound like crap, so dont over do it too much.
    This mp3 is ready to go
    Warning: Spoilers inside!

    once you have your mp3, open the brstm creator/converter tool that was linked at the start. go to the loop tab and turn off looping. If you dont turn it off, the file will get slightly bigger and might cause problems.
    Turn off looping
    Warning: Spoilers inside!

    Once you have turned off looping, then go back to the "Quality" tab. Uncheck the box that says "limit bytes to:" this will be help so we can get custom Sampling rates to make the brstm be equal or less then 214kb in size.
    Allow setting custom sample rates
    Warning: Spoilers inside!

    now its a game of trying to find the best balance of size and quality. once you have set a sample rate, you can click "Convert audio to BRSTM" and open your mp3 and it will make it into a brstm file. Make sure you put the newly made brstm file in a location that has no spaces in its path, so if you put it in "C:\bob joe\aaaaaaaa", the converter won't convert it to a bfstm in the next step, but paths like "C:\users\username\desktop" works. Once its done being created, you can then view the output's file size and listen to it in foobar2000. once you have a brstm that is equal or less then 214kb, you can move onto step 3
    this brstm is good to go
    Warning: Spoilers inside!

    Step 3. So now you have a brstm, you need to convert it into a bfstm. you can do so with the same tool used to create the brstm. Simply click the button in the lower right that says "Convert BRSTM to BFSTM (Wii U)" and open your brstm. The source BRSTM must be located in a path with no spaces, and the file name itself must have no spaces. If all went well, you should have a bfstm in the same folder as the brstm
    This bfstm is perfect
    Warning: Spoilers inside!

    Once you have a bfstm, you'll need to download AboodXD's BFSTM to BFWAV tool linked above and extract it to a folder. Then open cmd.exe and go to the folder you extracted the tool into. With python 3 installed, type "python conv.py " (yes, with the space), but dont press enter yet. Click and drag your bfstm into the command prompt and the path to the file should appear. Now you can press enter and it should convert the bfstm into a bfwav. Once its done, you can play the resulting .bfwav with foobar2000 to check to make sure you like the output. once done, you can move onto the hard part, step 4: injecting the sound
    how your command should look (I renamed my python 3 exe to python3.exe as I have both 3.6 and 2.7 installed)
    Warning: Spoilers inside!
    This bfwav will work perfect for replacing the star man sound
    Warning: Spoilers inside!

    Step 4. now its time for the fun part: injecting the new sound into the old song. We are doing this so its easier to copy and paste it into "turbo_sound.bfsar" later. If you havent done so already, download HxD or some other hex editor of your choice. This guide will be covering how to do this using HxD. First, go into the "turbo_sound_CUT" folder and make a copy of "turbo_sound_00000003.bfwav" and name it something. I will be calling mine "goat file.bfwav". open both "goat file.bfwav" and your bfwav we just made into HxD. In your new bfwav tab in HxD, hit control-A and then control-C to copy all of the hex from the file. Switch over to the Goat file's tab and hit control-B. It will replace a huge chunk of the original theme's hex with your new theme.
    Pasting your new bfwav over the old one
    Warning: Spoilers inside!

    If you get a message saying "this will cause a file size increase", your new bfwav is too big and you need to start over with making a new one. if you are brought to the bottom of a bunch of red text and theres black text under it, your new bfwav is smaller then the original file. This is a simple fix, however. On the right side of all the numbers, you'll see some characters. when you click on one of then, it highlights a hex value on the left. What you want to do is find a period that corresponds with hex value 00 so then you can just zero out the rest of the original song.
    This period stands for hex value 00, so you can copy
    Warning: Spoilers inside!

    Once you have found a period that stands for hex value 00, highlight it and copy it. then place your cursor at the start of the black text and press and hold control-B until you have replaced all of the black text with red text. Then you can either press control-s or click the floppy disk in the top left to save your work. The only thing left is step 5: injecting into turbo_sound.bfsar
    Zeroing out the rest of the old star man theme
    Warning: Spoilers inside!

    you may notice if you play the completed goat file in foobar2000 that there are a few small audio pops at the very end. This is normal, for whatever reason when you zero out the rest of the old starman theme, it does that. Since the game normally only plays the first 1-2 seconds of it during normal play, you wont hear it.

    Step 5. Now its time to inject the new starman theme into "turbo_sound.bfsar". since this bfsar is really a bunch of .bfwavs packed into it, we can just use a hex editor and replace it. you can close your new bfwav file (NOT THE GOAT FILE, the one you copied from), and have the goat file open, along with "turbo_sound_00000003.bfwav" and "turbo_sound.bfsar". first, we need to find where the star man theme is located in the file. To do so, we will be using HxD's search feature. copy the first line of hex from "turbo_sound_00000003.bfwav" and then switch back over to "turbo_sound.bfsar".
    Highlighting the first line of hex
    Warning: Spoilers inside!

    Once you have switched back over to "turbo_sound.bfsar" in HxD, press control-f. A box should appear. you need to click the "Datatype" drop down box and change its option from "Text-string" to "Hex-values", as we are trying to find raw hex in the file.
    The HxD search box
    Warning: Spoilers inside!

    Once you changed the datatype to "Hex-Values", paste the hex we copied from "turbo_sound_00000007.bfsar" into the box above with text to the left that says "Search for:" and then press enter. It should bring you to the location of the string in the file. Look over to the left at the blue numbers and make note of what address the string is located at. In my case its located at "0029E560". Make note of this, it will be helpful later.
    The start of the starman music
    Warning: Spoilers inside!

    Once you have taken note of it, go back to "turbo_sound_00000003.bfwav" and go to the very bottom of the file, and copy the last line of hex (its not as long as the start string, but it will still work), then go back to "turbo_sound.bfsar" and search for that string. It should bring you down the file more to the location of the string. In my case the string is located at "002D3FB0". Make note of that aswell, it will be useful for checking your work later. After you have taken note, go back to the first line of hex for the star theme (you can just scroll to the top of the file, click the very start, then search the first line again to find it) and place your cursor right before the first hex value of the starman theme.
    Where to put your cursor
    Warning: Spoilers inside!

    With your cursor in the right place, go into the goat file and press control-a and then control-c to copy everything inside the goat file. Then switch back to "turbo_sound.bfsar", double check your mouse pointer is in the right place, and press control-b to paste over all of the old starman music. Double check to make sure it ends at the second value you took note of a little bit ago. if it does, save "turbo_sound.bfsar" and go test it with cafiine or something. If all went well, when you use a star the music should be different.

    if you want an example of replaced starman music, I have created an ips patch that you can use lunar IPS (found here: http://fusoya.eludevisibility.org/lips/) to patch a stock "turbo_sound.bfsar" with to have the star sound replaced with a portion of the Starman theme from super mario guy RPG by lordofthejimmy on youtube

    I hope this guide helped one of you. After googling for hours yesterday, I couldnt find how to replace a sound inside of a .bfsar anywhere, so I figured out how to the hard way.

    Also, sorry for any gammar mistakes or whatever, I have a hard time catching them so if you see one, let me know

    Attached Files:

  2. Alex4U

    Alex4U edgy

    Jan 6, 2016
    with Snivy, Mystery Zone (Adress 0x00)
    Hard to follow, but nice.