Creating Interactive BMS Files

From Pikmin Technical Knowledge Base
Jump to: navigation, search

To do: Add diagrams and example images.

So you want your pikmin 2 music to have the interactivity of normal pikmin 2 songs? Well, I can tell you how to do that. While Flaaffy made bms files dont have interactivity, enough hex editing can fix that. Note that this all only applies to the four overworld themes. Caves use a completely different system for interactive music that isn't yet understood. Also note that music made this way wont have the Louie swing variant, just the interactive event tracks(working, treasure, enemy near, combat, spiderwort) and the sunset version. (Keep in mind this tutorial assumes you have at least decent knowledge of Hex editing going in).


Getting started[edit]

First off, make your midi. It's good to know ahead of time what tracks will serve what purpose. Remember that the combined total of all tracks can't exceed 16. I usually have between 5 - 8 main tracks and 1-2 for each of the special mixes. also make sure you have AudioRes/Seqs/seq.arc extracted, with all the bms files ready to replace. n_tutorial.bms is the Valley of Repose theme, Forest.bms is the Awakening Wood theme, yakushima.bms is the Perplexing Pool theme, and last.bms is the Wistful Wild theme.

Next, make the bms of your midi like you normally would with Flaaffy. The instruments and banks you choose with flaaffy don't matter. Make sure each track only loads an instrument and program once at the beginning of the track and never again. Get your bms and open it in HxD. Also open specifically the original last.bms in HxD. Regardless of what song your making, last.bms is the easiest to work with by far.

In last.bms, delete everytyhing after 0x04 90, leaving just the header. Now, in your flaaffy bms do a search for the first instance of a4 20 in the bms, and delete everything before that. It should be around 2 lines in. Now, cut and paste whats left of the flaaffy bms to the end of last.bms.


Staying Organized[edit]

You will surely want a text file with notes to keep yourself orgranized, because things can get messy coming up. Look at figure 1 to see how I format mine. From now on a track of the flaaffy bms will be reffered to as a "note set" and the actual tracks of the bms are just "tracks". You'll want to write down the offset of every instrument youre using, the offset of every note set, and what track uses what note set and instrument. Using this will make the "track setting" step far easier.


Setting Loops[edit]

Now that you have the base of your interactive bms, its time to set the looping for every track. First, go to 0x04 90. You should see A4 20. Remember the offset this a4 20 is at. Now search for the next a4 20 in the bms. Now you're at the start of the next note set. Before anything else, add padding 00s to move the a420 you just found to the start of a new line. It will simplify steps in the future. Look back a bit and you will see the last track's looping jump branch. In a standard flaaffy bms, it will be an offset to the start of the note set followed by a "E7". Replace this E7 with FF and change the offset right before it to the start of the previous a4 20 plus 0x6. For example. If a track has a a4 20 starting at 0x0d 90, the loop offset at the end should look like this, C8 00 00 0d 96. Continue to do this for every note set, search for a4 20, move it to the start of next line, change the loop offset to point to the a4 20 +6, change the E7 to FF. do this until you get to the final track. Make sure as you do this, take notes of the offset of every a4 20. The final line has to be 32 byte aligned, so add 00 padding if needed.

Setting Instruments[edit]

Go to the top part of your bms. Specifically, jump to offset 0x 03 2b. You will see a C4, followed by 00 00 01 8E. This part shouldn't be touched, but the part after it is important. There should be a A4 20 XX A4 21 XX. The byte following a4 20 is the bank this instrument will use. The a4 21 is the program. Make sure you know what bank and programs can be used within the bms you are replacing. Also keep in mind these are hex values, so program 14 would be entered as A4 21 0e, not A4 21 14. Continue to look around for these a4 21s, and take notes on the program number and the offset to the C4 in the C4 00 00 01 8E before it. The instrument offset at 0x 04 53 specifically is strange because it sets a program twice, only the second one matters though.

Setting Tracks[edit]

Now that you have the loops for all the note set set up, and all the instrument setting in place, its time to actually assign the note set offsets and instrument offsets for each track. First, go to the header of the bms. Specifically, go to 0x1CB. You should see a C4, followed by two 00s and a value. This value is the instrument of the first track. This is where the notes youve been taking come in use. Change this value to the instrument you want track 1 to use. After this is a C8. After this is the note set offset. Change this to the offset of the note set you want, plus 0x9. For example, if you want it to jump to note set 1, that will always be at 0x0490. Lets say we want it to use an instrument at 0x03 EA. The Hex data will look like this: C4 00 00 04 99 C8 00 00 03 EA FF. That FF at the end signifies the end of this tracks data, afterwards is the next tracks data. Note that it alternates with the sunset versions of tracks, so it goes "track 1, track 1 sunset, track 2, track 2 sunset" and so on. For sunset versions of songs, I normally make tracks I want using bank 4 program 50, and tracks I don't want set to any instrument that isn't actually loaded with the wscene, so it's silent. The note set should usually be the same as the normal equivalent, unless you're really trying to be creative. Repeat this process, setting the instrument and note set for every music track in the bms.

Final Touches[edit]

Once you have set the insrtument and note set for every track, you're nearly done! Next, we need to set the tempo of the bms. Go to 0xE9 in the bms, and you should see a FD. After it is a 2 byte value that is the tempo. It may take trial and error to get the proper value for this. Sometimes I need it as low as 100, other times as high as 400. Also, I've noticed that the game tends to crash if there isn't enough 00 padding at the end of the bms, so I recomend adding another line or two.

Once your tempo is set, We're done with the bms! But we aren't done yet. Go to user/Wakai/trackMap_seq_W.txt, and find your bms file's settings. Now you set how many tracks each variant gets! "basic" is the standard mix, "event" is the working mix, "otakara event" is the treasure mix, "kehai" is the enemy near mix, "battle" is the combat mix, and "ground" is the spiderworts. the "pikmin" stuff after this doesn't seem to do anything. Another thing worth mentioning is the global volume of the bms that is set in user/totaka/bgmlist.txt.