Tutorial [Tutorial] Custom Music With Luma's LayeredFS

bungboi

Well-Known Member
OP
Member
Joined
Oct 31, 2017
Messages
100
Trophies
0
Age
27
XP
328
Country
United States
I am not responsible for any damage caused to your console, but I am open to help if you have problems.
Always keep a NAND backup handy. (Make one using the NANDManager script included with the GodMode9 download.)


Please note, LayeredFS doesn't work for Smash. You're gonna need SaltySD.

Introduction to LayeredFS
LayeredFS allows you to replace game files without dumping/altering game files. With this, and GodMode9, you can insert custom music into the majority of 3DS games.

Requirements:
1. A 3DS running Luma3DS
2. GodMode9
3. A .BCSTM converter

4. The .wav of the song you want (Very important: The song must be a 16 bit wav, less than 3.3mb, it must be stereo, and it should be at 22.050 kHz. You can do this with Audacity.
Mounting the Game
Mounting a Digital Game
1. Boot into GodMode9 by holding Start on boot
2. Select "SYSNAND SD" and then select "title"
tLTGROw.png
9oHjkns.png
3. Hold R and press A. You'll see a set of options come up on the bottom screen. Press "Search for titles"
fbIdKTN.png
4. Look through the list of titles, and find your game. (In this case, I'm using 3D Land)
5. Select the game, press "TMD file options," and then select "Mount CXI/NDS to drive"
vrn7bxH.png
6. When prompted, press A to enter the path.

You can now continue on to finding the music!


Mounting a Cartridge Game

1. Boot into GodMode9 by holding Start on boot
2. Select "GAMECART" and then select the .3ds file (not the .trim.3ds)
3. In the list of options, select "NCSD image options," and then select "Build CIA from file"
SRbxefu.png
4. Once it's finished, go to "SDCARD (3DS)," select "gm9," and then select "out"
5. Select the new CIA file, select "CIA image options," and then select "Mount image to drive" (In the screenshot, it says /out/newdir. This is just a temporary folder I made.)
zg4RkWw.png
6. When prompted, press A to enter the path.
7. You may be put into a folder that looks like the screenshot below. Select the top folder, and if it has "exefs," "romfs," and "exefs.bin," then you're in the right spot.
lm9zpQs.png
7Psxgp6.png

You can now continue on to finding the music!

Finding the Music
1. You have now mounted the game, and you'll be able to browse the files. Select the folder named "romfs"
2. Now, we have to find where the .BCSTM files are. Most of the time, there'll be a folder named something like "Sound," or in this case "SoundData"
3. Select this folder, and, if needed, select the stream folder.
4. And there's all of the music! Open a notepad document and type in the directory at the top. In my case I'd type "/romfs/SoundData/stream"
qphhORb.png
5. Find the BCSTM file you want to replace. I want to replace the music for the World 1 map, so go to your notepad document and write down the names of the .BCSTM files (in my case it'd be STM_BGM_WORLD1_A and B)
n0w6MrM.png

(screenshot not in spoilers because it's important to write down the directory and file names)

You now have the name and the directory of the music you want to replace, (for me, it's /romfs/SoundData/stream/STM_BGM_WORLD1_A.bcstm and B.) You can now turn off your 3DS.

Converting your music
1. Open the BCSTM converter and have your .wav music ready. (Keep in mind, it must be a 16 bit wav at 22.050 kHz, less than 3.3mb, and it must be stereo.)
2. Uncheck "Limit bytes to:" and set the sampling rate as 22050 kHz
3. Press "Convert audio to BRSTM," and then name the file anything you want
4. After that, press "Convert BRSTM to BCSTM" in the bottom left and select the file you just made. You now have a playable 3DS audio file.

KFbSVG5.png

(screenshot not in spoilers because it's important for good quality audio)

5. Take your new BCSTM file and rename it to the same name(s) that's in your notepad document. For me, it was STM_BGM_WORLD1_A.bcstm and B, so I'll copy and paste the BCSTM twice and rename them accordingly

UOyNoNk.png
Getting your music to play in game
1. On your computer, go to the Luma folder on your SD card. In here, make a folder named "titles"
2. In the titles folder, make a new folder and name it the title ID for your game. To find the title ID, go here, (3D Land is 0004000000054000)
3. In the new title ID folder, copy how your notepad document looks (for me, it was /romfs/SoundData/stream, so I'll make folders on the SD card with those names)
7Hud49u.png

(screenshot not in spoilers because it's important)
4. In the last folder, put in the BCSTM file(s)
5. Put the SD card back into the 3DS, and hold Select while booting.
6. Check "Enable game patching," and then press Start to boot.

When you launch the game, it should replace the game's music with yours. If the audio sounds glitchy, you're going to need to fix it in Audacity using the rules in the requirements section.
If you want to turn off the music, simply hold Select while booting, and uncheck "Enable game patching."
Enjoy your custom music! :)
 
Last edited by bungboi,

bobbywall2003

New Member
Newbie
Joined
Jul 16, 2017
Messages
2
Trophies
0
Age
19
XP
45
Country
United States
How do you make the audio wav less than 3.3mb I’m trying to add songs to SM3DL and my songs are 10mb or more I can make the file 16 bit but I can’t compress the file size to 3.3mb
 

bungboi2

Member
Newcomer
Joined
Aug 7, 2019
Messages
6
Trophies
0
Age
27
XP
107
Country
United States
Turns out that WAV file size rule was an error in my writing and I ended up losing the original account I wrote this on lmao

Changing the Sample Rate

Anyways, the BCSTM file is the file that must be 3.3MB or less, NOT the WAV file. However, the other rules apply to the WAV file.
If the sample rate is not at 22.050, use the Tracks menu in Audacity and click Resample. Then, change that number to 22050.

60iDY84.png

y9aMiTX.png


Next, make sure the audio is 16 bit and stereo.

Stereo/Mono checking

If the audio is not stereo and you are using a song that should be stereo, I would look at getting a new copy of the song that is in stereo.
If the audio is not stereo but the song is basically just mono played in both ears, you should copy the single track onto another mono track and merge them.
Click Tracks, and then make a new mono track.

JBWlBLq.png


After the mono track is made, press Ctrl+A to select all music and then press Ctrl+C to copy. Then, select the far left of the new track, (make sure when you select the far left, a yellow line pops up. This indicates the beginning of the track.) Press Ctrl+V to paste the song at the beginning of the track.

.
Ee2tQIN.png

Once you've pasted the song into the new track, click on the top audio track's settings, (check the pictures below for clarification) and then click Make Stereo Track

vmJlXwY.png
ciJWiCa.png


Format Checking (16/32 bit)
To check the format settings, look at the track info at the left side of the application.

y9aMiTX.png

If the track info matches the info above, you can go ahead and export the song. If your track does not say "16-bit PCM", then click the audio track settings, go to Format, and change the format to 16 bit.

0E8t37U.png
 
Last edited by bungboi2,
  • Like
Reactions: bobbywall2003

bobbywall2003

New Member
Newbie
Joined
Jul 16, 2017
Messages
2
Trophies
0
Age
19
XP
45
Country
United States
I followed all the instructions but the game crashes after a few seconds of the song playing. I’m trying to replace the beach theme from 3D Land with the beach theme from 3D World. The weird thing is even though the game is frozen I can still access the Rosalina Menu.
 
Last edited by bobbywall2003,

TheCosmicWarrior

Well-Known Member
Newcomer
Joined
May 4, 2020
Messages
53
Trophies
0
Age
19
Website
www.youtube.com
XP
678
Country
United States
I followed all the instructions but the game crashes after a few seconds of the song playing. I’m trying to replace the beach theme from 3D Land with the beach theme from 3D World. The weird thing is even though the game is frozen I can still access the Rosalina Menu.
Since there are multiple variants of that song that play, you need multiple audio channels that match to the amount of themes there are, in this case, the beach theme, and the underwater variant of it.
 

AleronIves

Well-Known Member
Member
Joined
Nov 17, 2016
Messages
392
Trophies
0
Age
34
Location
California
XP
1,584
Country
United States
Thanks for pointing out that we can use Luma for music replacement without needing to mess with ROM hacking. This saved me a lot of time!

I thought I'd add a few corrections. First, there is no size limit on music. The size limit only applies to Home Menu themes, AFAIK. Games routinely use BCSTM files that are ~5 MiB in size, and some are close to 10 MiB.

You also shouldn't always target 22050 Hz by default; you should look at what the game's original music was using and target that. After you extract the existing BCSTM, you can play it with vgmstream, which is available as a foobar2000 plugin, among other options. Fb2k will let you look at the sample rate and channel count by going to the file properties window. Most likely the music will be stereo and use 22050, 32000, 44100, or 48000 Hz. You should resample your music to match whatever rate the game is using. If you're replacing some kind of jingle or other sound effect, you may aso need to downmix to mono if the original file is mono.

*edit*

I found another trick if a new song won't play in game. If you open a BCSTM in a hex editor, offset 0x08 contains a version number. If the new BCSTM has a different version number than the BCSTMs that came with the game, it may refuse to play the new song. Simply hex editing the version number to match the other BCSTMs can solve the problem without having to repack or transcode the audio.
 
Last edited by AleronIves,
General chit-chat
Help Users
    Dark_Phoras @ Dark_Phoras: And I was like that too, until I left social media. Now sometimes I'm grabbing my phone, opening...