ScoreFile is a language designed to
represent, create, and manipulate music data. The code for a
ScoreFile program is maintained in a file,
called a scorefile, on the disk. A scorefile
represents a MusicKit
MKScore
object and its contents in
ASCII form. Scorefiles can be created from a text
editor or generated automatically by a MKScore
or MKScorefileWriter
object. A scorefile is
interpreted when it's read by a MKScore
object
or performed by a MKScorefilePerformer
object.
There is also a binary format scorefile. The binary format is more than twice as fast to read as the ASCII form. The utility convertscore converts from one to the other. Binary format scorefiles are called “Optimized scorefiles” and have the .playscore file extension.
This chapter describes the syntax and conventions of the ScoreFile language. The presentation in this chapter assumes a familiarity with Chapter 4. A concise outline of ScoreFile syntax can be found in Appendix C. A comparison to other note-list formats is presented in Chapter 8.
A ScoreFile program is divided into two sections, the header and the body. The header always precedes the body; the two sections are separated by a BEGIN statement. The end of the scorefile can be marked by an optional END statement:
header BEGIN; body [ END; ] |
Either section can be empty. If the body is empty, the BEGIN statement can be omitted.
Both the header and the body are made up of ScoreFile statements. The header contains statements that establish the context in which the body is interpreted. The following statements can appear only in the header:
Score info statements
part statements
Part info statements
noteTagRange statements
The body consists of a time-ordered series of statements that
represent MKNote
objects. This information is
found only in the body:
Time statements
Note statements
A number of other statements can appear in either the header or the body:
Variable declarations
Assignment statements
envelope statements
waveTable statements
object statements
include statements
print statements
tune statements
comment and endComment statements