Knietfeld
Member
I'm here to show you how you can have two banks of music and Sound effects. The Underworld Map uses Bank1A and the Overworld Map uses Bank1B.
It seems like a pretty complex task, but I did a lot of the work for you. I'm pretty confident anyone relatively familiar with NESMaker and Famitracker will be successful following this tutorial.
For this tutorial, all you have to do is download a file, move it to the right place, change five files in Nesmaker's Script Settings, rename a file, change a few labels in that file, comment out one line in that file, and maybe change all the names of all the instruments in a famitracker project. Super easy! And maybe a little tedious.
A Few Things Before We Get Started
Using Overworld/Underworld to determine which music bank to use made sense to me, but if you would rather have a ScreenFlag determine the music bank, the files I provide will probably give you a good framework to build off of. If you're decent with coding you can probably figure it out. You may only need to change the variable that is checked from WarpMap to ScreenFlags00 for example or you may have to dive in and figure out what variables are available for initialization to work. If you figure it out it'd be great if you shared your findings in the comments here. I didn't look into it but I'd be happy to help if anyone asks.
Before doing this, I suggest having your sound effects and your music that will be in the "underworld" map finalized that way you don't have to go through the steps of importing both music files again. After all this is done, changing the music for the Overworld is just like changing the music now, but the Underworld is a bit more tedious, so it'd be nice to only have to do it once. It's not terrible, but doing importing two music files several times in a day is annoying. This is just a suggestion though, I'm sure I'm not the only one here who would prefer to make sure my project can contain the music before I go to the trouble of writing more.
The Easy Part
First, if you haven't already, make a copy of your NESMaker folder and use that from now on for this game. The method I've set up for putting all the scripts in the right place replaces the WarpToScreen macro which will cause problems in other NESMaker projects using the same NESMaker folder. I needed to modify the macro because every time you warp screens it needs to check which music bank to use and I didn't want to modify every script that calls this macro, changing the macro is
easier for both of us.
Follow this link and click the download icon to download my GameEngineData folder.
Open your new copied Nesmaker folder and drop the new GameEngineData folder into NESmaker_4_5_x. It will place all my new scripts in the correct folders for you.
Doing this doesn't affect any of your current scripts since all the new ones have different names, except for the WarpToScreen macro.
If you change your mind and want to change back all the scripts, there is a copy of the original WarpToScreen macro in the System folder now, (you would just drop it into the Macros folder to replace the modified one) though it's pretty easy to comment out what I added to WarpToScreen anyway.
Now, you need to change out all the pertinent scripts in Script Settings. All the new scripts are in the same folder as the scripts they will be replacing.
From top going down, the ones to change are:
In System, change NMI to NMI_SecondMusicBank_1A
In Banks, change Bank1A and Bank1B to Bank1A_SecondMusicBank_1A and Bank1B_SecondMusicBank_1A.
In Game, change "Initialize" and "Main Game Loop" to the new ones ending in _SecondMusicBank_1A.
If you've already edited any of the scripts that my files would replace and you don't want to lose your code, don't worry. I've left comments in my modified scripts and you can find any of my modifications by searching "kn-". just compare your scripts to mine and add in what I changed. I only added a few lines of code in most of these scripts and it shouldn't be hard to add in my stuff. I tried to mark the top and bottom of my main additions. If you've already done something with Bank1A, and hope to just add this code and a little bit of music to some other code you've already added to that bank, just make sure all of my Bank1A stuff comes first. There's one part in NESMaker's code that relies on the first part of Bank 1A and Bank1B being nearly perfect copies of each other to work.
The Part You Have to Work for
As you should expect, you'll need two separate Famitracker projects that already import correctly into NESMaker. One will end up in Bank1A and be useable in Underworld screens, the other will end up in Bank1B and be useable in Overworld screens.
You can use completely different styles of Famitracker projects. They don't need to have the same number of songs or sound effects. They don't need to have the same instruments or even the same number of instruments. If you're game has separate game modes or something and you truly do want everything completely different, I suggest you make sure the file with more songs is the file in Bank1B. I'll explain why later.
But most likely you will want to have the same sound effects and instruments in both the overworld music and the underworld music. You may even want to have some songs available in both maps. However, if you use the same names in both you'll get a bunch of "label already defined" errors when you finally compile the game. To overcome that, you've got to rename a whole bunch of stuff, and it's best to do that before importing anything.
While testing I used the music and sound effects from the 4.5.x tutorials and I just added _1A to everything for my underworld music. I just copied _1A it and pasted it onto every name in the project. Just check out the names in the picture.
You'll need to do that for everything that is shared across the two maps.
It will be easier for you if you have the same number of songs and sound effects in both maps, and unless you plan on sound effects sounding different in the underworld, you'll want to keep the sound effects in the same order in both files.
Once you've finished editing names and you have your "AwesomeMusicForBank1A.ftm" ready, in Famitracker, click file and "Export Text" then in NESMaker right click Sound, and select "Import Famitracker .txt." If there are no problems with your .txt you can now click "Export and Test asm" and Oh no! You have an error!
But don't worry this is all part of the plan. The compiler can't find Bank 1A's music file, "AllSongs_WithSFX_1A.asm", because you haven't made it yet. While the compiler didn't make your game, it did make it's usual AllSongs_WithSFX file. You just have to go to your newly copied NESMaker folder \NESMaker_4_5_x\GameEngineData\Sound and rename AllSongs_WithSFX to AllSongs_WithSFX_1A. Now it exists.
Open AllSongs_WithSFX_1A and scroll down a bit. You will need to update three list labels to make them become, song_list_1A, sfx_list_1A, and instrument_list_1A. They shouldn't be hard to find. The names have to be exactly that because those are the names you Bank1A sound Engine is looking for.
But before you export and test your game again, import the music you want for Bank1B into NESMaker.
When you test your game again, this music will be written into AllSongs_WithSFX and the Bank1A music will be in AllSongs_WithSFX_1A.
continued in the first comment, I've said too much
It seems like a pretty complex task, but I did a lot of the work for you. I'm pretty confident anyone relatively familiar with NESMaker and Famitracker will be successful following this tutorial.
For this tutorial, all you have to do is download a file, move it to the right place, change five files in Nesmaker's Script Settings, rename a file, change a few labels in that file, comment out one line in that file, and maybe change all the names of all the instruments in a famitracker project. Super easy! And maybe a little tedious.
A Few Things Before We Get Started
Using Overworld/Underworld to determine which music bank to use made sense to me, but if you would rather have a ScreenFlag determine the music bank, the files I provide will probably give you a good framework to build off of. If you're decent with coding you can probably figure it out. You may only need to change the variable that is checked from WarpMap to ScreenFlags00 for example or you may have to dive in and figure out what variables are available for initialization to work. If you figure it out it'd be great if you shared your findings in the comments here. I didn't look into it but I'd be happy to help if anyone asks.
Before doing this, I suggest having your sound effects and your music that will be in the "underworld" map finalized that way you don't have to go through the steps of importing both music files again. After all this is done, changing the music for the Overworld is just like changing the music now, but the Underworld is a bit more tedious, so it'd be nice to only have to do it once. It's not terrible, but doing importing two music files several times in a day is annoying. This is just a suggestion though, I'm sure I'm not the only one here who would prefer to make sure my project can contain the music before I go to the trouble of writing more.
The Easy Part
First, if you haven't already, make a copy of your NESMaker folder and use that from now on for this game. The method I've set up for putting all the scripts in the right place replaces the WarpToScreen macro which will cause problems in other NESMaker projects using the same NESMaker folder. I needed to modify the macro because every time you warp screens it needs to check which music bank to use and I didn't want to modify every script that calls this macro, changing the macro is
easier for both of us.
Follow this link and click the download icon to download my GameEngineData folder.
Open your new copied Nesmaker folder and drop the new GameEngineData folder into NESmaker_4_5_x. It will place all my new scripts in the correct folders for you.
Doing this doesn't affect any of your current scripts since all the new ones have different names, except for the WarpToScreen macro.
If you change your mind and want to change back all the scripts, there is a copy of the original WarpToScreen macro in the System folder now, (you would just drop it into the Macros folder to replace the modified one) though it's pretty easy to comment out what I added to WarpToScreen anyway.
Now, you need to change out all the pertinent scripts in Script Settings. All the new scripts are in the same folder as the scripts they will be replacing.
From top going down, the ones to change are:
In System, change NMI to NMI_SecondMusicBank_1A
In Banks, change Bank1A and Bank1B to Bank1A_SecondMusicBank_1A and Bank1B_SecondMusicBank_1A.
In Game, change "Initialize" and "Main Game Loop" to the new ones ending in _SecondMusicBank_1A.
If you've already edited any of the scripts that my files would replace and you don't want to lose your code, don't worry. I've left comments in my modified scripts and you can find any of my modifications by searching "kn-". just compare your scripts to mine and add in what I changed. I only added a few lines of code in most of these scripts and it shouldn't be hard to add in my stuff. I tried to mark the top and bottom of my main additions. If you've already done something with Bank1A, and hope to just add this code and a little bit of music to some other code you've already added to that bank, just make sure all of my Bank1A stuff comes first. There's one part in NESMaker's code that relies on the first part of Bank 1A and Bank1B being nearly perfect copies of each other to work.
The Part You Have to Work for
As you should expect, you'll need two separate Famitracker projects that already import correctly into NESMaker. One will end up in Bank1A and be useable in Underworld screens, the other will end up in Bank1B and be useable in Overworld screens.
You can use completely different styles of Famitracker projects. They don't need to have the same number of songs or sound effects. They don't need to have the same instruments or even the same number of instruments. If you're game has separate game modes or something and you truly do want everything completely different, I suggest you make sure the file with more songs is the file in Bank1B. I'll explain why later.
But most likely you will want to have the same sound effects and instruments in both the overworld music and the underworld music. You may even want to have some songs available in both maps. However, if you use the same names in both you'll get a bunch of "label already defined" errors when you finally compile the game. To overcome that, you've got to rename a whole bunch of stuff, and it's best to do that before importing anything.
While testing I used the music and sound effects from the 4.5.x tutorials and I just added _1A to everything for my underworld music. I just copied _1A it and pasted it onto every name in the project. Just check out the names in the picture.
You'll need to do that for everything that is shared across the two maps.
It will be easier for you if you have the same number of songs and sound effects in both maps, and unless you plan on sound effects sounding different in the underworld, you'll want to keep the sound effects in the same order in both files.
Once you've finished editing names and you have your "AwesomeMusicForBank1A.ftm" ready, in Famitracker, click file and "Export Text" then in NESMaker right click Sound, and select "Import Famitracker .txt." If there are no problems with your .txt you can now click "Export and Test asm" and Oh no! You have an error!
But don't worry this is all part of the plan. The compiler can't find Bank 1A's music file, "AllSongs_WithSFX_1A.asm", because you haven't made it yet. While the compiler didn't make your game, it did make it's usual AllSongs_WithSFX file. You just have to go to your newly copied NESMaker folder \NESMaker_4_5_x\GameEngineData\Sound and rename AllSongs_WithSFX to AllSongs_WithSFX_1A. Now it exists.
Open AllSongs_WithSFX_1A and scroll down a bit. You will need to update three list labels to make them become, song_list_1A, sfx_list_1A, and instrument_list_1A. They shouldn't be hard to find. The names have to be exactly that because those are the names you Bank1A sound Engine is looking for.
But before you export and test your game again, import the music you want for Bank1B into NESMaker.
When you test your game again, this music will be written into AllSongs_WithSFX and the Bank1A music will be in AllSongs_WithSFX_1A.
continued in the first comment, I've said too much