Musica II File Format

****************************************************************************************************************

Musica II

Lester Hand's Notes

Bill,

I've done some digging into the source files and doing some file dumps. Here is some of what you seek:

The first byte of the file is $00 followed by the length of the file (word), and then the offset to the start of music ($4000). Following are 4 wave (tone) tables, each 256 bytes long.

The note block has the following format: It starts with the default tempo and tone tables ($64 $40 $40 $40 $40). See below for translation.

One thing to note is that when a chorus effect is used, the pitches are detuned slightly (and become undisplayable). But that shouldn't affect a play only program.

So here is an example of a simple music fragment:

7F 0AD9 091F 0000 0000 40 0C2D 089C 0000 0000

This translates to:

whole note v1=C4, v2=A3, v3=blank, v4=blank

half note v1=D4, v2=G#3, v3=blank, v4=blank

Bar lines are indicated with the chord length=$FF. The pitch data (4 words) is set to $00.

Change tone tables and tempo markers have the chord length=$FE followed by the 4 tone table numbers + $3F, the tempo * 2, and 3 bytes set to $00.

Repeat bar lines are marked with the chord length=$FD. The pitch data (4 words) is set to $00.

Repeat play markers have the chord length=$FC followed by one byte indicating the repeat section (1-9), and 7 bytes set to $00.

Repeat sections are marked with the chord length=$FB

The last chord is one byte long with the length set to $00, followed by $3983. That last word I am not sure about (it may be specific to the version I'm looking at).

I think you can ignore the tone registers. The 4 wave tables that precede the music have all the information you need unless you need re-calculate them. I think the 8X ($83 $82 $86 $82) is irrelevant; I don't remember anything about those bytes.

I hope that will get you on track to writing your program! I wish I had documented the file format back 30 years ago like I did for Lyra... You may find that my decoding isn't always correct. Let me know if you find exceptions.

Lester Hands


Note Tables:

Musica File Format

Taken from what I could gather from the Musica sources from Lester Hands

Note Lengths:

Whole $7F

Half $40

Quarter $20

8TH $10

8Th Trip $0B

16TH $08

16TH Trip $05

32ND $04

64TH $02

PITCH Note Value

**********************

$2B67 C6 1046

$28F8 C6b

$2B66 B6#

$28F7 B6 987

$26AB B6b

$26AA A6# 932

$247F A6 879

$2273 A6b

$2272 G5# 830

$2084 G5 783

$1E81 G5b

$1EB0 F5# 739

$1CF7 F5 698

$1B58 F5b

$1CF6 E5#

$1B57 E5 659

$19CF E5b

$19CE D5# 622

$185B D5 587

$16FE D5b

$16FD C5# 554

$15B3 C5 523

$147C C5b

$15B2 B5#

$147B B5 493

$1356 B5b

$1355 A5# 466

$123F A5 439

$113A A5b

$1139 G4# 415

$1042 G4 391

$F59 G4b

$F58 F4# 369

$E7B F4 349

$DAC F4b

$E7A E4#

$DAB E4 329

$CE8 E4b

$CE7 D4# 311

$C2D D4 293

$B7F D4b

$B7E C4# 277

$AD9 C4 261

$A3E C4b

$AD8 B4#

$A3D B4 246

$9AB B4b

$9AA A4# 233

$91F A4 219

$89D A4b

$89C G3# 207

$821 G3 195

$7AD G3b

$7AC F3# 184

$73D F3 174

$6D6 F3b

$73E E3#

$6D5 E3 164

$674 E3b

$673 D3# 155

$616 D3 146

$5C0 D3b

$5BF C3# 138

$56C C3 130

$51F C3b

$56B B3#

$51E B3 123

$4D6 B3b

$4D5 A3# 116

$48F A3 109

$44F A3b

$44E G2# 103

$410 G2 97

$3D7 G2b

$3D6 F2# 92

$39E F2 87

$36B F2b

$39D E2#

$36A E2 82

$33A E2b

$339 D2# 77

$30B D2 73

$2E0 D2b

$2DF C2# 69

$2B6 C2 65

Music File Block Formats

Default Tone Block 1st 5 bytes in the file. (After 5 byte ML Header)

$64 $40 $41 $42 $43

| | | | |____ Tone Table# for Voice 4 = $40+Tone table #0-3

| | | |________ Tone Table# for Voice 3 = $40+Tone table #0-3

| | |___________ Tone Table# for Voice 2 = $40+Tone table #0-3

| |______________ Tone Table# for Voice 1 = $40+Tone table #0-3

|__________________ Master Tempo

Note Block 9 Bytes

$10 $0000 $0000 $0000 $0000

| | | | |____ 2 Byte Word for Frequency of Voice 4

| | | |__________2 Byte Word for Frequency of Voice 3

| | |_______________ 2 Byte Word for Frequency of Voice 2

| |_____________________2 Byte Word for Frequency of Voice 1

|________________________ 1 Byte Note Length (See Note Length Chart)

Barline Block 9 Bytes

$FF $0000 $0000 $0000 $0000

| | | | |____ 2 Byte Word Empty

| | | |__________2 Byte Word Empty

| | |_______________ 2 Byte Word Empty

| |_____________________2 Byte Word Empty

|________________________ 1 Byte Barline Indentifier

Tone/Tempo Block 9 Bytes

$FE $00 $00 $00 $00 $00 $00 $0000

| | | | | |___________ 1 Byte Tempo (displayed tempo * 2)

| | | | |______________ Tone Table# for Voice 4= $40+Tone table #0-3

| | | |__________________ Tone Table# for Voice 3= $40+Tone table #0-3

| | |_____________________ Tone Table# for Voice 2= $40+Tone table #0-3

| |_________________________ Tone Table# for Voice 1= $40+Tone table #0-3

|_____________________________ 1 Byte Tone/Tempo Indentifier

Repeat Barline (left & right) Block 9 Bytes

$FD $0000 $0000 $0000 $0000

| | | | |____ 2 Byte Word Empty

| | | |__________2 Byte Word Empty

| | |_______________ 2 Byte Word Empty

| |_____________________2 Byte Word Empty

|________________________ 1 Byte Left & Right Repeat Barline Indentifier

Section Marker Block 9 Bytes (software must store locations of up to 9 markers)

$FC $0000 $0000 $0000 $0000

| | | | |____ 2 Byte Word Empty

| | | |__________2 Byte Word Empty

| | |_______________ 2 Byte Word Empty

| |___________________ 2 Byte Word Empty

|_______________________ 1 Byte Section Marker Indentifier

Section Repeat Block 9 Bytes

$FB $00 $00 $0000 $0000 $0000

| | | | | |____ 2 Byte Word Empty

| | | | |__________2 Byte Word Empty

| | | |_______________ 2 Byte Word Empty

| | |___________________ 1 Byte Empty

| |_______________________ 1 Byte Section number (1-9)

|__________________________ 1 Byte Section Repeat Indentifier

The Voice Harmonic Registers

The "Voice Harmonic Registers", added in Musica II, directly follow the music block content. The last music block is a 3 byte block comprising of "$00 $39 $83". The 4 harmonic tables follow as ASCII text (not sure what the final byte represents):

1 9:60605101 + $20

2 7:84020001 + $86

3 6:24828100 + $82

4 9:24644201 + $00

Each value is like a "weight" on an organ "drawbar". The first value, "X:" is the volume weight, the following 8 values are the 8 harmonic weight values. These 9 values can be set from 0-F by the user.

Title Lines

Musica II files also have the possibility of having two "title lines" that display on the Musica II screen while a song plays. There are 2 lines, of 32 bytes each, padded with spaces. The title line immediately follow the harmonic registers

Musica II File Format Overview

Offset # Bytes Description

0 5 Standard 5 byte DECB machine language header

5 256 Frequency table for voice 1

261 256 Frequency table for voice 2

517 256 Frequency table for voice 3

773 256 Frequency table for voice 4

1029 ??? Begining of Music Blocks, can be any length, the loader must count the

bytes loaded to know where the "Title" is located near the end of the

music blocks.

xxxx(0) 3 End Block, signifying the end of the music.

($00 $39 $83)

The following Musica 2 ONLY (not Music 1) and are offsets xxx from the beginning of the above $003983 end block (not documented in Lester's format description):

3 13 Voice 1 Harmonic registers

16 13 Voice 2 Harmonic registers

29 13 Voice 3 Harmonic registers

42 13 Voice 4 Harmonic registers (ends in zero NULL)

55 64 2 x 32 byte lines for the 2 line title

119 5 Standard 5 byte machine language footer ( $FF00 $00 $xxxx exec addrs)

The easiest way I found to locate the Voice Harmonic registers and title lines are by "seek"ing to the end of the file, then "seek" back 121 bytes.

I hope this document is useful to someone (it was for me) and if you have any questions, suggestions, or corrections, I can be contacted on the maltedmedia Coco email list or email me directly.

Bill Pierce