BMS file

From Pikmin Technical Knowledge Base
Jump to navigation Jump to search

A .bms file holds data for sequenced music in Pikmin 2. BMS files are similar to MIDI files, but have many more advanced features. Custom BMS files can be made with Flaaffy by Arookas (which can be found here), however Yoshi2's fork of Flaaffy is better suited to making BMS files for Pikmin 2. You can find that here.

Documentation[edit]

To do: Actually document every byte of a bms header and music data and what it all means.

A BMS file is made up of a sequence of commands which are a single byte, and can include a range of arguments. Each command has a fixed number of arguments. Values are read as big endian.

Commands 00 to 7F: Play note. The command itself is the midi pitch of the note, and is the only time this happens. The first argument is the voice ID to play on, voices are limited from IDs 1-7. The second argument is the velocity of the note, otherwise known as the volume, and ranges from 00-7F.

Command 80 (2 bytes): Wait. The first argument is the amount of ticks to wait.

Commands 81-87 (1 byte): Stop voice. This command has no arguments. The second nibble indicates the voice ID to stop playing.

Command 88 (3 bytes): Wait. This is similar to command 80, but the first argument is 16 bit instead of 8 bit, allowing for longer wait times.

Command 98 (3 bytes): Set. This command can set different parameters depending on the first argument, with the second argument being the value to set it to. 00 is for volume, 02 is for reverb. It is unknown if there are more, and requires further testing.

Command 9A (4 bytes): Set. This command is similar to command 98 except with a third argument that is unknown and requires further testing. 03 is for panning.

Command A4 (3 bytes): Set. This command seems to be the same as command 98, except maybe with different parameters (untested). 07 is unknown but used in Wistful Wild, 20 is for the audio bank, 21 is for the instrument.

Command B1 (5 bytes): Unknown. Needs further testing. Third argument seems to define a channel's number (untested).

Command C8 (5 bytes): Jump. First argument is 32 bit, and jumps the channel to that exact byte.

Command E6 (3 bytes): Vibrato. Used very rarely. First argument is 16 bit, and sets the intensity of the vibrato. 1000 seems to be a range of 1 semitone total, as the max of FFFF has a range of 16 semitones total. A full cycle of vibrato lasts 0.18 seconds but could change with BPM (needs testing). Vibrato DOES NOT affect a note after it stops, meaning if a note has a notable release, it will stay at the same pitch for the duration of its release.

Command F1 (2 bytes): Low pass. First argument is the amount. It's unknown exactly the frequency these will correspond to. Setting this value any higher than 7F will break it, and if it's high enough will it cause the instrument to have a very high high pass filter.

Command FD (3 bytes): BPM. First argument is 16 bit. Setting this value too high will cause the game to freeze while it plays the music as fast as the CPU will allow it.

Command FE (3 bytes): Timebase. First argument is 16 bit. Sets the amount of ticks per beat. Ticks define the smallest amount of time that can pass between commands. This is usually 120 (decimal).

Command FF (1 byte): End. This defines the end of a track's data, and will cause it to stop playing until the song is replayed.

List of BMS files[edit]

A full list of all the BMS files in Pikmin 2 can be found here.

Interactive music[edit]

A lot of BMS music in Pikmin 2 is interactive, meaning that parts of it change depending on what you do in the game. BMS files produced by Flaaffy do not support this by default, however they can be modified to be interactive. A tutorial to do this can be found here. This currently only applies to overworld music and will not work for caves.