MusicFileDefs.mesa
Copyright (C) 1983, 1984 Xerox Corporation. All rights reserved.
Author: John Maxwell
Last Edited by: Maxwell, November 18, 1983 2:12 pm
Last Edited by: Doug Wyatt, June 11, 1984 4:07:48 pm PDT
This module gives the format for the file on the disk.
Changing this module may make old music files obsolete.
MusicDefs imports from here whenever its types exactly match these.
MusicFileDefs: CEDAR DEFINITIONS
= BEGIN
versionID: INTEGER = 3;
ID: TYPE ~ MACHINE DEPENDENT {nullID(0), scoreID(1), eventID(2), noteID(3), chordHeapID(4), chordID(5), beamHeapID(6), beamID(7), viewID(8), tieID(9), (CARDINAL.LAST)};
MusicFile is just a conceptual tool to help one understand the file format.
the identifiers are used to make sure that the file has been read in correctly.
(You may wish to eliminate these, but then old files will no longer work.)
MusicFile: TYPE = MACHINE DEPENDENT RECORD[
version: INTEGER,
score: RECORD[
id: ID ← scoreID,
events: SEQUENCE length: CARDINAL OF EventFormat
],
chordHeap: RECORD[
id: ID ← chordHeapID,
chords: SEQUENCE length: CARDINAL OF ChordFormat
],
beamHeap: RECORD[
id: ID ← beamHeapID,
beams: SEQUENCE length: CARDINAL OF BeamFormat
],
spare1: ID ← nullID, ++ spare identifiers.
spare2: ID ← nullID, ++ all spares are set to zero until needed
spare3: ID ← nullID, ++ these spares are for: ties, slurs,
spare4: ID ← nullID, ++ eventExeptions, noteExceptions, and strings.
spare5: ID ← nullID,
spare6: ID ← nullID,
spare7: ID ← nullID,
spare8: ID ← nullID,
spare9: ID ← nullID,
view: ViewFormat
];
EventFormat: TYPE = MACHINE DEPENDENT RECORD[
identifier: ID ← eventID,
time: LONG INTEGER ← 0,
type: EventTypeFormat ← notes,
ignore: BOOLEANFALSE, -- do not use this bit
spare1: [0..1000) ← 0,
value: INTEGER ← 0, -- may be a time signature
spare2: CARDINAL ← 0,
length: CARDINAL ← 0 -- followed by:
notes: ARRAY [0..length) OF NoteFormat OR
sheet: SheetFormat depending on 'type'
];
TimeFormat: TYPE = LONG INTEGER;
EventTypeFormat: TYPE = MACHINE DEPENDENT {
notes, measure, repeat1, repeat2, endMeasure, doubleMeasure, m5,
timeSignature, keySignature, metronome, staves, clef, octava1, octava2, spare5, spare6,
spare7, spare8, spare9, spare10, spare11, spare12, spare13, spare14
};
SheetFormat: TYPE = MACHINE DEPENDENT RECORD[
junk: LONG CARDINAL ← 0, -- garbage filler
height: INTEGER ← 0,
offset: INTEGER ← 0,
sl: CARDINAL ← 0,
staff: ARRAY [0..6) OF StaffFormat ← ALL[[]]
];
StaffFormat: TYPE = MACHINE DEPENDENT RECORD[
pitch: INTEGER ← 0, -- pitch of note on bottom line
y: INTEGER ← 0 -- height relative to bottom line
];
NoteFormat: TYPE = MACHINE DEPENDENT RECORD[
identifier: ID ← noteID,
pitch: INTEGER ← 40,
voice: CARDINAL ← 0,
value: NoteValueFormat ← unknown, --3 bits
spelled: AccidentalFormat ← inKey, --3 bits
rest: BOOLEANFALSE,
dotted: BOOLEANFALSE,
doubleDotted: BOOLEANFALSE,
grace: BOOLEANFALSE,
stemUp: BOOLEANFALSE,
exception: BOOLEANFALSE,
embellish: EmbellishmentFormat ← none, --3 bits
tie: BOOLEANFALSE, -- if TRUE, a TieFormat follows
show: BOOLEANFALSE,
spare4: [0..2000) ← 0,
staff: [0..16) ← 1,
spare2: CARDINAL ← 0, --legato, stacatto, accents
spare3: CARDINAL ← 0,
toc: LONG CARDINAL ← 0,
duration: CARDINAL ← 0
];
NoteValueFormat: TYPE = MACHINE DEPENDENT {
whole, half, quarter, eighth, sixteenth, thirtysecond, sixtyfourth, unknown
};
AccidentalFormat: TYPE = MACHINE DEPENDENT {
doubleSharp, sharp, natural, inKey, flat, doubleFlat
};
EmbellishmentFormat: TYPE = MACHINE DEPENDENT {
none, trill, mordent1, mordent2, e1, e2, e3, e4
};
ChordFormat: TYPE = MACHINE DEPENDENT RECORD[
identifier: ID ← chordID,
stemUp: BOOLEANFALSE,
exception: BOOLEANFALSE,
spare1: [0..16000) ← 0,
exceptionPTR: CARDINAL ← 0,
spare2: INTEGER ← 0,
length: CARDINAL ← 0
notePTRs: ARRAY [0..length) OF RelativePTR;
];
BeamFormat: TYPE = MACHINE DEPENDENT RECORD[
identifier: ID ← beamID,
tilt: REAL ← 0,
beamed: BOOLEANFALSE,
exception: BOOLEANFALSE,
ntuple: [0..128) ← 0,
against: [0..128) ← 0,
height: INTEGER ← 0,
invisible: BOOLEANFALSE,
spare1: [0..1024) ← 0,
staff: [0..32) ← 0,
spare2: CARDINAL ← 0,
length: CARDINAL ← 0
chordPTRs: ARRAY [0..length) OF RelativePTR;
];
TieFormat: TYPE = MACHINE DEPENDENT RECORD[
identifier: ID ← tieID,
height: INTEGER ← 0,
heap: CARDINAL ← 0,
index: CARDINAL ← 0
];
RelativePTR: TYPE = MACHINE DEPENDENT RECORD[
heap: CARDINAL,
index: CARDINAL
];
beams: CARDINAL = 64000; -- used in RelativePTR
chords: CARDINAL = 64001; -- used in RelativePTR
ViewFormat: TYPE = MACHINE DEPENDENT RECORD[
identifier: ID ← viewID,
scale: INTEGER ← 0,
accidental: BOOLEANFALSE,
notehead: BOOLEANFALSE,
sync: BOOLEANFALSE,
display: DisplayModeFormat ← physical,
noCarry: BOOLEANFALSE,
hardcopy: BOOLEANFALSE,
spare1: [0..512) ← 0,
sheet: INTEGER ← 0, --will later be made obselete
speed: INTEGER ← 0, --will later be made obselete
key: INTEGER ← 0, --will later be made obselete
spare5: INTEGER ← 0,
spare6: INTEGER ← 0
];
DisplayModeFormat: TYPE = MACHINE DEPENDENT {physical,logical,graphical};
END.