データフォーマット(Data Format)

曲・効果音シーケンスデータ(Music and SE Sequence)

ヘッダー (Header)

Address SizeContents
0x0000 BYTE トラック数 (BGM:max=5, SE:max=2)
Number of track
0x0001 BYTE 効果音の優先度 (Lv = 0〜3)
Lower 2bit : Priority for SE
0x0002 WORD[n]シーケンスデータのオフセットアドレス(ヘッダーのアドレス0x0000が基点)。
Offser address for music sequence data. (Based on header address 0x0000.)
- Music sequence datas.

曲データ (Music Sequence Datas)

ポインターと記載された場合は、現アドレスからの相対アドレスを意味します。
"Pointer" meaning relative address from this memory address.

op-code value Contents
0x00 End of Track / End of Subroutine
0x01 n1 n2 Jump(Dal Segno.) (End of Track with loop)
n1::n2 = jumping pointer.
0x02 n1 n2 Sub-routine call
n1::n2 = Pointer of sub-routine.
0x03 n1 Repeat(A) Start point.
n1 = repeat times
0x04 n1 n2 Repeat(A) Branch point
n1::n2 = Pointer of exit.
0x05 n1 n2 Repeat(A) End point.
n1::n2 = Pointer of start.
0x06 n1 n2 SE call
n1::n2 = Pointer of SE.
0x07 n1 n2 n3 Write data to memory.
n1::n2 = Address. / n3 = Writing data
0x08 n1 Tempo
n1 = tempo [BPM]
0x09 n1 a note/rest length when length is omitted
n1 = length [Ticks]
0x0A n1 Gate time (key-off timing from last)
n1 = length [Ticks]
0x0B n1 Gate time
n1 = length [Ticks]
0x0C n1 Relative Tempo
n1 = tempo [BPM]
0x0D Gate mode (no release. volume = 0)
0x0E Gate mode (release of command value)
0x0F Gate mode (release of envelop pattern)
0x10 n1 n2 Voice envelop.
n1::n2 = Pointer.
0x11 n1 n2 Volume envelop.
n1::n2 = Pointer.
0x12 n1 n2 Frequency envelop.
n1::n2 = Pointer.
0x13 n1 n2 Note envelop.
n1::n2 = Pointer.
0x14 n1 Detune
n1*100/16 [Cent]
0x15 n1 Detune (Resister base)
n1 = detune
0x16 n1 APU : Sweep (Resister base)
FDS : Sweep (Modulator) bias
VRC6: -
VRC7: Sustain Switch
MMC5: -
n16x: Sample length
Sunsoft 5B: Envelop Switch & Type
0x17 n1 n2 n3 n4Portamento
n1 = Decay (1 = 1 VBlank)
n2 = Rate (1 = 1 VBlank)
n3 = Depth (16 = 100 [cent])
n4 = Target (1 = 100 [cent])
0x18 Repeat(B) Start point
0x19 Repeat(B) Branch point
0x1A n1 n2 Repeat(B) End point
n1::n2 = Pointer of start.
0x1B n1 Voice (Voice Envelop Off)
n1 = Voice number.
0x1C n1 n2 VRC6: Set user instrument
n1::n2 = Pointer.
0x1D n1 n2 VRC7: Set resister
n1 : Resister
n2 : Data
0x1E n1 n2 n3 n16x: Set wave table
n1 = Addres
n2::n3 = Pointer.
0x1F n1 n16x: Set Channel number
n1 = number of channel
0x20 Volume down (-1)
0x21 Volume up (+1)
0x22 n1 n2 FDS : Set career wave table
n1::n2 = Pointer.
0x23 n1 n2 FDS : Set modulator wave table
n1::n2 = Pointer.
0x24 n1 n2 FDS : Modulator frequency
n1::n2 = Frequency
0x25 n1 FDS : Master volume
n1 = master volume
0x26 n1 n2 Sunsoft 5B: Envelope frequency
n1::n2 = Frequency
0x27 reserve
0x28 Octave down (-1)
0x29 Octave up (+1)
0x2A n1 Transpose (an absolute value)
n1 = Transpose (sighed char)
0x2B n1 Transpose (a relative value)
n1 = Transpose (sighed char)
0x2C Octave down (only next note)
0x2D Octave up (only next note)
0x2E n1 One time transpose (a relative value)
n1 = Transpose (sighed char)
0x2F - Expand op-code
0x30-0x37 n1 Voice of release (after key-off)
n1 = Voice number
0x38-0x3F Octave 1-8 (op-code lower 4bit is value)
0x40-0x4F a note/rest length when length is omitted
(op-code lower 4bit is value)
0x00 : 96 tick (l1)
0x01 : 72 tick (l2.)
0x02 : 48 tick (l2)
0x03 : 36 tick (l4.)
0x04 : 32 tick (l3)
0x05 : 24 tick (l4)
0x06 : 18 tick (l8.)
0x07 : 16 tick (l6)
0x08 : 12 tick (l8)
0x09 : 9 tick (l16.)
0x0A : 8 tick (l12)
0x0B : 6 tick (l16)
0x0C : 4 tick (l24)
0x0D : 3 tick (l32)
0x0E : 2 tick (l48)
0x0F : 1 tick (l96)
0x50-0x5F Gate time (op-code lower 4bit is value)
0x60-0x6F Volume (op-code lower 4bit is value)
0x70-0x7F Volume of release (op-code lower 4bit is value)
0x80-0xFF (n1) (n2) Note and Rest
op-code bit 7 = `H'
op-code bit 6 = flag of Thai & Slur
op-code bit 5 = flag of Length (n1 [tick])
op-code bit 4 = flag of Gate Time (n2 [tick])
op-code bit 3-0 = note
0x00 : C
0x01 : Cis / Des
0x02 : D
0x03 : Dis / Es
0x04 : E
0x05 : F
0x06 : Fis / Ges
0x07 : G
0x08 : Gis / As
0x09 : A
0x0A : Ais / Bs (B)
0x0B : B (H)
0x0C : r (release of gate mode)
0x0D : r (no release. volume = 0)
0x0E : r (release of command value)
0x0F : r (release of envelop pattern)
Expand op-code (Op-code = 0x2F)
sub op-code value Contents
0x00 Jump flag on
0x01 Jump flag off
0x02 n1 Relative Detune (16 = 100 cent)
0x03 n1 Relative Detune (Resister base)
0x04-0xFF reserved

エンベロープ・パターン(Envelope pattern)

データ構造(Struct)

Address Contents
0x00 Pointer of release (after key-off)
If setting `0', no release pattern.
0x01 - Envelop pattern

パターン(Pattern)

op-code Contents
0xxx xxxx <2> xxx xxxx (7bit) = Envelope value
1000 xxxx <2> xxxx (4bit) = Hold length (0=1[Vblank], 1=2[Vblank], ...)
11xx xxxx <2> xx xxxx (6bit) = Address of jump

FDS音源音色パターン(FDS career wave pattern)

This is 64[Bytes] data.

FDS音源変調パターン(FDS modulator wave pattern)

This is 32[Bytes] data.

n16x音源音色パターン(N16x wave pattern)

Address Contents
0x00 Number of byte (Must be a multiple of 2)
0x01 - Wave table pattern (1[Byte] is 2 samples)

VRC7音源音色パターン(VRC7 instruments data)

This is 8[Bytes] data based on register.