BME (File Format)

From Luma's Workshop
Revision as of 11:22, 13 February 2025 by SY24 (talk | contribs) (Created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

File Format

Binary Melody files store commands for the audio engine to play chords/melodies. The format is constructed of instructions (OpCodes) similar to BMS files. Super Mario Galaxy & Super Mario Galaxy 2 each only have one BME file, stored in AudioRes/Info/JaiMe.arc/bme/defaultme.bme.

Header

The header is constructed like this:

Offset Type Description
0x0 UInt32 (0x4) Amount N of entries (0x28 in SMG, 0x29 in SMG2)
0x4 + N * 0x4 UInt32 (0x4) Offset to BME data

Data

This page is in progress and may contain incomplete information or editor's notes.

Each instruction (OpCode) stands for its own function in the engine:

OpCode Function (SMG/SMG2) Usage Example Description
00 {OpCode[1]} {Bank[1]}
OpCode: one byte, 00.
Bank: one byte with range 0x00 through 0xFF. This byte represents a WSYS ID.
00 0A

00: OpCode
0A: WSYS ID 10
Defines the WSYS/IBNK whose sounds are to be used in a Track.
01 {OpCode[1]} {Program[1]}
OpCode: one byte, 01.
Program: one byte with range 0x00 through 0xFF. This byte represents a LIST entry in the IBNK belonging to the defined WSYS ID.
01 04

01: OpCode
04: IBNK LIST entry 4
Defines the Keyboard which holds more specific sounds from an IBNK.
02 {OpCode[1]} {Bank[1]} {Program[1]}
OpCode: one byte, 02.
Bank: one byte with range 0x00 through 0xFF. This byte represents a WSYS ID.
Program: one byte ranging from 0x00 through 0xFF. This byte represents a LIST entry in the IBNK belonging to the defined WSYS ID.
02 00 0D

02: OpCode
00: WSYS ID 0
0D: IBNK LIST entry 13
Defines the Instrument to be used in a Track.
10 {OpCode[1]} {TrackNumber[1]} {Pointer[3]}
OpCode: one byte, 0x10.
TrackNumber: one byte with unknown range.
Pointer: three bytes with range 0x000000 through 0xFFFFFF. Defines an offset in the file.
10 00 00 01 F5

10: OpCode
00: Track 0
00 01 F5: Offset
Creates a Track which plays a Melody individually.
20 {OpCode[1]} {Unknown}
OpCode: one byte, 0x20.
Unknown
Starts a Track.
24 {OpCode[1]}
OpCode: one byte, 0x24.
Stops execution of a Track.
40 {OpCode[1]} {Pointer[3]}
OpCode: one byte, 0x40.
Pointer: three bytes with range 0x000000 through 0xFFFFFF. Defines an offset in the file.
40 00 0B CF

40: OpCode
00 0B CF: Offset
Redirects execution to the defined offset. Execution can return with 71.
70
71 {OpCode[1]}
OpCode: one byte, 0x71.
Returns redirected execution (like from 40) to the initial call.