BRS (File Format): Difference between revisions

From Luma's Workshop
Jump to navigation Jump to search
(Added tag)
(Fixed Key)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
[[category:File formats]]
[[category:File formats]]
'''BRS''' ('''B'''inary '''R'''emix '''S'''equence) files contain sequence data for the NoteFairy (Rainbow Notes) object. ''Super Mario Galaxy'' and ''Super Mario Galaxy 2'' each contain only one '''BRS''' file, located in <code>AudioRes/Info/JaiRemixSeq.arc/brs/defaultremixseq.brs</code>.
{{WIP}}'''BRS''' ('''B'''inary '''R'''emix '''S'''equence) files contain sequence data for the NoteFairy (Rainbow Notes) object. ''Super Mario Galaxy'' and ''Super Mario Galaxy 2'' each contain only one '''BRS''' file, located in <code>AudioRes/Info/JaiRemixSeq.arc/brs/defaultremixseq.brs</code>.


== Header ==
== Header ==
The '''BRS''' format contains no header magic like most files do. Instead, it consists of a Sequence Count and Pointers. The size of the header is <code>0x4 + (Sequence Count x 0x4)</code>:
The '''BRS''' format contains no header magic like most files do. Instead, it consists of a Sequence Count and Offsets. The size of the header is <code>0x4 + (Sequence Count x 0x4)</code>:
{| class="wikitable"  
{| class="wikitable"  
|-
|-
Line 16: Line 16:


=== Offsets ===
=== Offsets ===
Each pointer holds the offset of a Sequence relative to the beginning of the file and is formatted like this:
Each offset holds the offset of a Sequence relative to the beginning of the file and is formatted like this:
{| class="wikitable"  
{| class="wikitable"  
|-
|-
Line 45: Line 45:
|}
|}


== Note Duration (?) ==
== Unused/Unknown Section ==
The header is followed by a section that (presumably) defines the duration of each Note. This section's size is <code>Note Count x 0x4</code>.
The header is followed by a section that doesn't seem to do anything. This section's size is <code>Note Count x 0x4</code>.
{| class="wikitable"  
{| class="wikitable"  
|-
|-
Line 55: Line 55:
| 0x00
| 0x00
| UInt32 (0x4)
| UInt32 (0x4)
| Note Duration (?)
| Unused/Unknown
|}
|}


== Track ==
== Track ==
Each Track starts by defining its instrument (0x4), followed by the individual Key-presses for a Note (0x10 each). There is no padding between Tracks.
Each Track starts by defining its instrument (0x4), followed by the individual Key-presses for a Note (0x10 each). There is no padding between Tracks.
Only 16 keys can be played at once.
=== Instrument ===
=== Instrument ===
{| class="wikitable"  
{| class="wikitable"  
Line 68: Line 70:
|-
|-
| 0x00
| 0x00
| ??? (0x2)
| UInt16 (0x2)
| Likely unused
| Not used
|-
|-
| 0x02
| 0x02
| UInt8 (0x1)
| UInt8 (0x1)
| Set Bank
| Bank Number
|-
|-
| 0x03
| 0x03
| UInt8 (0x1)
| UInt8 (0x1)
| Set Prog
| Program Number
|}
|}


=== Key ===
=== Key ===
Duration's intended range is 0-1440 after being scaled. Any value above 1440 is clamped to 1440. However, due to the first 3 bytes being discarded at one point, a scaled duration above 255 can cause unexpected behavior.
For instance, if a scaled duration is 0x1234, it is clamped to 0x05A0 (1440) and the 0x05 is discarded later on, making 0xA0 (160) how long it actually plays for.
The tempo at any given time is calculated using: (player_magnitude * 3600.0) / (note_fairy_path_length / note_count)
The scaled duration is calculated using: (120.0 * duration / tempo)
{| class="wikitable"  
{| class="wikitable"  
|-
|-
Line 89: Line 98:
| 0x00
| 0x00
| UInt32 (0x4)
| UInt32 (0x4)
| Key (0x00 = C-1, 0x60 = C4 (middle C), 0x7F = G9, FFFFFFFF = None)
| Key (0x00 = C-1, 0x3C = C4 (middle C), 0x7F = G9, FFFFFFFF = None)
|-
|-
| 0x04
| 0x04
| UInt32 (0x4)
| UInt32 (0x4)
| Velocity
| Velocity. Valid range: 0-127.
|-
|-
| 0x08
| 0x08
| UInt32 (0x4)
| UInt32 (0x4)
| Duration
| Duration (in ticks?). Scaled to the tempo the song is being played at.
Valid range: 0-255 after being scaled.
|-
|-
| 0x0C
| 0x0C
| UInt32 (0x4)
| UInt32 (0x4)
| Delay
| Delay (in ticks?)
|}
|}


== Sequences in SMG & SMG2 ==
== Sequences in SMG & SMG2 ==
A sequence can be defined in Obj_arg4 for the NoteFairy object. The following sequences are available in both games:
A sequence can be defined in Obj_arg4 for the NoteFairy object. Obj_arg4 directly corresponds to the sequence index in defaultremixseq.brs. The following sequences are available in both games:
{| class="wikitable"  
{| class="wikitable"  
|-
|-

Latest revision as of 18:09, 11 January 2025

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

BRS (Binary Remix Sequence) files contain sequence data for the NoteFairy (Rainbow Notes) object. Super Mario Galaxy and Super Mario Galaxy 2 each contain only one BRS file, located in AudioRes/Info/JaiRemixSeq.arc/brs/defaultremixseq.brs.

Header

The BRS format contains no header magic like most files do. Instead, it consists of a Sequence Count and Offsets. The size of the header is 0x4 + (Sequence Count x 0x4):

Offset Type Description
0x00 UInt32 (0x4) Sequence Count

Offsets

Each offset holds the offset of a Sequence relative to the beginning of the file and is formatted like this:

Offset Type Description
0x00 UInt32 (0x4) Offset

Sequence Header

Each sequence's header consists of a Track and Note Count:

Offset Type Description
0x00 UInt32 (0x4) Track Count
0x04 UInt32 (0x4) Note Count

Unused/Unknown Section

The header is followed by a section that doesn't seem to do anything. This section's size is Note Count x 0x4.

Offset Type Description
0x00 UInt32 (0x4) Unused/Unknown

Track

Each Track starts by defining its instrument (0x4), followed by the individual Key-presses for a Note (0x10 each). There is no padding between Tracks.

Only 16 keys can be played at once.

Instrument

Offset Type Description
0x00 UInt16 (0x2) Not used
0x02 UInt8 (0x1) Bank Number
0x03 UInt8 (0x1) Program Number

Key

Duration's intended range is 0-1440 after being scaled. Any value above 1440 is clamped to 1440. However, due to the first 3 bytes being discarded at one point, a scaled duration above 255 can cause unexpected behavior.

For instance, if a scaled duration is 0x1234, it is clamped to 0x05A0 (1440) and the 0x05 is discarded later on, making 0xA0 (160) how long it actually plays for.

The tempo at any given time is calculated using: (player_magnitude * 3600.0) / (note_fairy_path_length / note_count)

The scaled duration is calculated using: (120.0 * duration / tempo)

Offset Type Description
0x00 UInt32 (0x4) Key (0x00 = C-1, 0x3C = C4 (middle C), 0x7F = G9, FFFFFFFF = None)
0x04 UInt32 (0x4) Velocity. Valid range: 0-127.
0x08 UInt32 (0x4) Duration (in ticks?). Scaled to the tempo the song is being played at.

Valid range: 0-255 after being scaled.

0x0C UInt32 (0x4) Delay (in ticks?)

Sequences in SMG & SMG2

A sequence can be defined in Obj_arg4 for the NoteFairy object. Obj_arg4 directly corresponds to the sequence index in defaultremixseq.brs. The following sequences are available in both games:

Obj_arg4 Name Note Count Notes
0 Super Mario Bros. main theme (long) 13 Unused
1 Super Mario Bros. main theme (short) 7 Unused
2 Super Mario Bros. underground theme 43
3 Super Mario Bros. main theme (short) 7 Unused
4 Super Mario Bros. underwater theme 46
5 Super Mario World bonus room theme 64