Difference between revisions of "Creating Interactive BMS Files"

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search
m
Line 91: Line 91:
  
 
=== Missing/dropped notes ===
 
=== Missing/dropped notes ===
This is an another issue with flaaffy. If a "Note Off" also occurs at the same time a "Note On" does, or multiple "Note On"s occur at the exact same millisecond, flaaffy won't render these correctly. You might run into this often when instruments try to play chords.<br>
+
This is an another issue with flaaffy. If a "Note On" also occurs at the same time a "Note Off" does, or multiple "Note On"s occur at the exact same millisecond, flaaffy's BMS won't render those notes. You might run into this often when instruments try to play chords.<br>
  
The simple fix for flaaffy is to make sure notes of the same pitch do not touch each other, and to slightly skew or slant the notes of chords.
+
The simple fix for flaaffy is to make sure notes of the same pitch do not touch each other (put a tiny bit of empty space between them), and to slightly skew/slant each note in chords.
  
 
<gallery mode="packed-hover" widths=400px heights=400px>
 
<gallery mode="packed-hover" widths=400px heights=400px>

Revision as of 10:02, 18 April 2024

This guide will function as a walkthrough for creating interactive music for Pikmin 2's main areas.

Requirements:

  • A DAW to create your own short MIDIs in, like FL Studio or Logic Pro. A DAW is also great for sketching out your song ideas/song's structure beforehand.
  • A MIDI to BMS converter, like flaaffy. You will be exporting each track of your MIDI separately as its own BMS file, and importing them one at a time.
  • A basic understanding of hexadecimal, and a hex editor. An editor that can dynamically resize the window is ideal (HxD on Windows, or Hex Fiend on MacOS are fantastic examples).

Most of the editing will be done in hexadecimal. Creating cave music is very similar.

Preparing and exporting MIDIs

You will be exporting each track of your song as its own separate MIDI file, and then convert each MIDI into a mini BMS file of its own.
If your song has 14 instruments, then you'll export 14 MIDIs. Make sure each track is the same length so that looping will work properly.

For some reason, imported BMS files play exactly 4 times as slow in interactive music. So if you import the tracks as is, they will play 4 times as slow.
Before you export them, you need to modify them to run 4 times as fast. Do not address this by changing the BPM in your DAW, you need to shorten the actual regions instead. How you will go about this will depend on your DAW; some will allow you to stretch entire regions of notes easily.

Logic Pro can easily speed up MIDI regions with MIDI Transform. You want to use the "Double Speed" transformation twice on each entire track.

(Note: While you *can* technically just multiply the BPM value by 4 in the BMS later on, Louie's variant is dependent on the BPM being something normal, so the swing will not be applied properly if you do that.)

Base BMS file

Starting from scratch, here is a base for you to work off of. In a hex editor, copy and paste this into a completely new, blank BMS file:

E74000A0 0003AC04 0104AA20 050400B1 C1400005 AC04010A AA200504 00B1C140 0105AC04 0110AA20 050400B1 C1400205 AC040116 AA200504 00B1C140 0305AC04 011CAA20 050400B1 C1400405 AC040122 AA200504 00B1C140 0505AC04 0128AA20 050400B1 C1400605 AC04012E AA200504 00B1C140 0705AC04 0134AA20 050400B1 C1400805 AC04013A AA200504 00B1C140 0905AC04 0140AA20 050400B1 C1400A05 AC040146 AA200504 00B1C140 0B05AC04 014CAA20 050400B1 C1400C05 AC040152 AA200504 00B1C140 0D05AC04 0158AA20 050400B1 C1400E05 AC04015E AA200504 00B1C140 0F05FE00 78FD0066 C8000001 9F884B00 C8000000 E9884B00 C8000000 F98001FF 0002AA00 071E0002 E600075A 00032200 07960003 5E0007D2 00039A00 080E0003 D600084A 00041200 08860004 4E0008C2 00048A00 08F30004 C600093A 00050200 09760005 3E0009B2 00057A00 09EE0005 B6000A2A 0005F200 0A660006 2E000AA2 C600E70E 00DF0700 018AE72E 00CF03C8 0000016E E70E00DF 0700018A E72E00CF 03C80000 0180E71E 00E3E700 00E70F00 DF070001 9BC600E7 1F00E3E7 0E00DF07 0001B9E7 4001C805 000000E7 2E00CF03 C8000001 A7E71E00 E74001C8 050001C5 E3E1C800 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 44617920 76657273 696F6E3A 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000042 00004900 00560000 50000000 00000000 00000000 5365713A 00000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000294C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0002D0C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 00030CC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000348C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000384C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0003C0C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0003FCC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000438C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000474C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0004B0C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0004ECC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000528C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000564C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0005A0C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0005DCC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000618C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 53756E73 65742076 65722E3A 00000020 20202000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000042 00004900 00560000 50000000 00000000 00000000 5365713A 00000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000708C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000744C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000780C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0007BCC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0008F8C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000834C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000870C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0008ACC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0008E8C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000924C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000960C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 00099CC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 0009D8C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000A14C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 000A50C8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 C4000001 8EA42004 A4212C98 007F9A03 400AC600 0000C400 00058CC8 00000B04 FF000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 FF000000 3C2D2028 4E756C6C 20747261 636B2061 74203078 30623034 2C20666F 7220616E 7920656D 70747920 74726163 6B732900 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 76767620 50617374 6520796F 75722073 65717565 6E636573 20686572 65212076 76760000 00000000 00000000 00000000 00000000 00000000 00000000

This file is setup with all the important information already filled out for you. You should resize the window so that you can see all 16 Day tracks and all 16 Sunset tracks evenly spaced on each line:

This section is sort of like a mixer; you can set the volume and stereo panning of each track. More importantly, you also choose the bank and program here.
Most importantly, at the end of each track, you select what sequence the track uses. You just type in the offset of the sequence there.

Importing sequences

Converting

Convert all your MIDIs into BMS files with flaaffy. You can use the following commands in the command line (make sure to include the "-loop" argument in the first command, so it knows to loop the sequence):

mareep.exe mareep -errand jolt -input exampletrack02.midi -output exampletrack02.txt -loop
mareep.exe mareep -errand cotton -input exampletrack02.txt -output exampletrack02.bms

Flaaffy turns the MIDI into a text file before it is converted into a BMS. The text file is "cotton", flaaffy's assembly language. Viewing the cotton file can be useful for double checking there's in fact only one track in each of your MIDIs. You will open each BMS file you make with flaaffy, and copy paste the hex data of each into the bottom of the Base BMS.

Copying and pasting

In your exported BMS, look for the instance of A420 (if there are multiple, use the last occurrence of it). This A420 is what sets the bank of the sequence, and it will be followed by either a 00, 01, 02, 03, 04, or 05 after it.

If you want to use bank 0, change it to A42000, if you want to use bank 4, change it to A42004, and so on.

Copy A420 and the entire remainder of the file, and paste everything into your Base BMS, anywhere at the bottom of it.

You should paste each converted BMS on a new line, separated by an empty line of zeros so its easy to tell where each sequence begins.

Looping

Notice the C80000XXXX at the very end of the sequence you pasted in (the C80000 will be the same, but the numbers at the end will be different). The "XXXX" tells the sequence where the song loops and should restart at. Change XXXX to be where the sequence starts in the base BMS file. (Ex: do C8000011D4 if the sequence starts at 0x11D4).

Finishing touches

Fill in the mixer

After you have imported all the sequences, have made sure all the A420's have the right bank, and looped them, go back to the Base BMS mixer and fill in the appropriate information. (Bank, program, volume, panning, sequence location.) The "sequence location" will be the offset where each A420 is.

(Note: You do not have to import the same sequence over and over again if there are any identical sequences; you are free to reference the same one sequence and just give them different instruments. This is useful for sunset versions or treasure mix instruments.)

Null track

If you don't want a track to play anything, have it go to the "null track" located at 0B04. (If you look, it's just a single "FF", which is a sequence that ends immediately.) This is what each track is set to by default in the provided Base BMS.

Tempo

You don't have to touch anything in the header at the top of the Base BMS, except for changing the BPM. The BPM for your song is located at 0xEA and takes up two bytes. (Ex: "0066" for 102 BPM).

Padding

Add in an extra line of zeros or two at the end of your finished Base BMS, because it sometimes crashes if extra padding is not there.

trackMap

Make sure the tracks in the Base BMS mixer go in order: Main -> Task -> Treasure -> Enemy near -> Battle -> Spiderwort. Same for the sunset version.
Open the sequence trackMap in /user/Wakai/, find the song you are replacing (forest.bms, last.bms...), and edit the values in the trackMap to reflect how many instruments will be in each mix. The main and sunset version will use the same mapping. You can make unnecessary tracks silent in the Base BMS's mixer if your sunset version has less instruments.

Troubleshooting

Tracks not looping correctly

Make sure each track is exactly the same length. You can export your entire song as one MIDI, convert it to BMS, and import it into the game as an un-interactive BMS file just to check. Flaaffy is finicky with looping occasionally; you may need to add a note at the end or start of a track so flaaffy knows thats the definitive start/end point of that track. (Make the note very quiet, low-pitch, and or short so its practically inaudible.)

Tracks not looping at all

Double-check you added the -loop argument in flaaffy. Test with an un-interactive BMS file. Make sure there isn't any stray information somewhere in your MIDI.

Volume/panning/program settings not working

It is possible there is volume automation, panning automation, or program changes somewhere in your MIDI/BMS you have imported. This is something you can add intentionally if you really want to (like changing the program for a track in the middle of the song), but it will override the values you put in the Base BMS mixer.

Missing/dropped notes

This is an another issue with flaaffy. If a "Note On" also occurs at the same time a "Note Off" does, or multiple "Note On"s occur at the exact same millisecond, flaaffy's BMS won't render those notes. You might run into this often when instruments try to play chords.

The simple fix for flaaffy is to make sure notes of the same pitch do not touch each other (put a tiny bit of empty space between them), and to slightly skew/slant each note in chords.

Alternatively, JAIMaker does not run into this issue for its BMS conversions. If you decide to use it instead, you will need to be more precise about importing the data from the BMS files into the Base BMS.