This page defines the lexical rules for Partitura source files.
Source Files
- Source files are UTF-8 text
- Files use the
.ptaextension - Keywords are case-sensitive
Whitespace
- Two-space indentation is canonical
- Opening braces appear on the same line as the block header
- One field or block entry per line
- Horizontal alignment whitespace is avoided
Comments
Comments start with # and continue to end of line:
# This is a comment
score {
title "My Score" # inline comment
}
Identifiers
Identifiers follow these rules:
- MUST start with an ASCII letter
- MAY then contain ASCII letters, digits,
_, or-
# Valid identifiers
p1
my-part
voice_1
staff-a
# Invalid identifiers (must start with letter)
1part
_voice
String Literals
String literals use double quotes:
title "Sonata in C Major"
composer "J.S. Bach"
Keywords
Keywords are English, case-sensitive terms. The canonical keyword families are:
| Family | Keywords |
|---|---|
| Top-level | score, metadata, config, defaults, part-list, parts, links, bookmarks |
| Metadata | work, work-title, work-number, movement-title, movement-number, identification, creator, rights, source, relation, encoding, software, encoder, encoding-description, encoding-date, support, miscellaneous, miscellaneous-field, credit, subtitle, page-number, text, image, symbol, page, system, justify, valign, halign |
| Structure | part-group, part-ref, part, staff, voice, measure |
| Music-data | note, backup, forward, direction, attributes, harmony, figured-bass, print, sound, listening, barline, grouping, link, bookmark |
| Note semantics | pitch, step, alter, octave, rest, unpitched, display-step, display-octave, chord, grace, cue, duration, type, dot, time-modification, actual-notes, normal-notes, normal-type, normal-dot, accidental, notehead, stem, beam, lyric, instrument, attack, release, print-object, print-dot, print-leger, default-x, default-y, relative-x, relative-y |
| Notation | tie, tied, slur, tuplet, glissando, slide, ornaments, technical, articulations, dynamics, fermata, arpeggiate, non-arpeggiate, accidental-mark, other-notation |
| Score state | divisions, key, time, staves, clef, transpose, staff-details, measure-style |
| Config/import | config, import-detail, source-shape, container-format, preserve, preserve-print, preserve-layout, preserve-appearance, preserve-defaults, preserve-reference-identity |
| Defaults/layout | scaling, concert-score, page-layout, page-margins, system-layout, system-margins, staff-layout, appearance, line-width, note-size, distance, glyph, other-appearance, music-font, word-font, lyric-font, lyric-language |
| Direction | tempo, words, wedge, segno, coda, fine |
| Harmony | root, kind, inversion, bass, degree, figure |
| Print/layout | margins, width, height, left, right, top, bottom, millimeters, tenths, page-height, page-width, left-margin, right-margin, top-margin, bottom-margin, system-distance, top-system-distance, staff-distance, font-family, font-style, font-size, font-weight, lang |
| Common | name, abbreviation, symbol, start, stop, number, group-barline, group-time, target, href, element, position |
Primitive Types
| Type | Canonical Form | Example |
|---|---|---|
| String | "text" |
"Sonata" |
| Boolean | true / false |
true |
| Integer | Base-10 digits | 4, 123 |
| Decimal | Digits with decimal point | 12.5, 0.8333 |
| Identifier | Letter-starting name | p1, my-part |
| Reference | @identifier |
@v1, @s1 |
Block Structure
Blocks use { and } delimiters:
score {
title "Example"
part "Piano" {
measure 1 {
note c4 quarter
}
}
}
Fields use name value syntax:
title "My Score"
composer "Author"
Repeated semantic objects are written as repeated blocks:
creator composer "Bach"
creator arranger "Editor"