ScoreScript Language wiki

Parts, voices, and measures

Parts first

Declare instruments with parts, then write each part's music in its body. A measure range labels a run of bars. Separate bars with |.

ScoreScript sourceDownload source
scorescript 0.3
score "Duet" {
  meter 4/4
  parts { fl ob }
  fl { m1-2 { 4C5 D E F | 1G } }
  ob { m1-2 { 2C4 E | 1G } }
}
Generated notationNotation for the preceding Parts, voices, and measures example
Canonical spelling
scorescript 0.3
score "Duet" {
  meter 4/4

  parts {
    fl
    ob
  }

  fl {
    m1-2 {
      4C5 D E F | 1G
    }
  }

  ob {
    m1-2 {
      2C4 E | 1G
    }
  }
}

Instrument keys and roster abbreviations identify instruments. A count such as fl: 2 declares two flutes. A printed name containing spaces is quoted: "Flute 1" { ... }. See the instrument reference for catalog keys. Counts must be positive whole numbers representable by the engine: fl: 0 is an error, not a way to omit a player. Remove the roster entry to omit it.

Measures first

To compare ensemble parts at the same moment, put the range outside the parts. The following has the same two lines of music as the duet above.

ScoreScript sourceDownload source
scorescript 0.3
score "Duet" {
  meter 4/4
  parts { fl ob }
  m1-2 {
    fl { 4C5 D E F | 1G }
    ob { 2C4 E | 1G }
  }
}
Generated notationNotation for the preceding Parts, voices, and measures example
Canonical spelling
scorescript 0.3
score "Duet" {
  meter 4/4

  parts {
    fl
    ob
  }

  m1-2 {
    fl {
      4C5 D E F | 1G
    }
    ob {
      2C4 E     | 1G
    }
  }
}

Each row supplies bars for its selected part. A plain trailing barline can continue a row onto the next physical line while the promised range still needs bars. A blank line ends a row. Do not turn rows into arbitrary newlines: the part-first and measure-first forms have different row structure.

Music or a named part group may begin immediately after the opening brace: m1 { 4C D E F } and m1 { fl { 4C D E F } } both work. A newline after the outer measure-first header is optional. In m3-6 { A B C D }, the four notes default to quarters in m3; m4–m6 are whole-bar rests. The range does not stretch those four notes across four bars.

ScoreScript sourceDownload source
m1-2 { 4Eb(p)< G 2Bb | 4.Eb &G 2F(mf) }
m3-6 { A B C D }
Generated notationNotation for the preceding Parts, voices, and measures example
Canonical spelling

m1-2 {
  "row 1" {
    4Eb4(p)< G 2Bb | 4.Eb &G 2F(mf)
  }
}

m3-6 {
  "row 1" {
    4A5 B C D
  }
}

Within a music row, a plain physical newline is not an arbitrary within-bar wrap: use a lone trailing backslash to continue an unfinished bar onto the next line. For smaller source, use native compaction, not a generic minifier.

The older colon grid is accepted and is produced by to-grid as a reading view. Ordinary formatting writes one of the label-before-body arrangements shown here. A label belongs before its opening brace.

Inside a measure-first block, fl,ob { ... } lets several instruments read the same passage. Shared and independent blocks may coexist; see shared passages and safe redundancy.

Keep m on measure blocks

Write m10-50 { ... }, not 10-50 { ... }, in both arrangements. The range is inclusive: measures 10 through 50, or 41 measures. The m identifies an address; it is not part of the music's duration. A single measure uses m10 { ... } or an addressed music row such as m10: 1C5. Bare numeric block headers are not accepted by the current grammar.

Maps have a different, explicitly named context: system-map {10, 50} lists two system starts, and tempo {96, 10:120} changes tempo at measure

  1. Their bare addresses do not make 10-50 { ... } a valid music block. Native formatting retains the m on measure-block addresses, including when compacting source; do not strip it with a text replacement. Formatting can regroup a long part-first range into smaller blocks without changing its measure addresses or music.

Simultaneous voices

Inside a measure-first block, separate rows under one instrument are simultaneous voices on that staff. The first row is voice 1; the second is voice 2. Each has its own rhythm and pitch reference.

ScoreScript sourceDownload source
scorescript 0.3
score "Two voices" {
  parts { violin }
  m1 {
    violin {
      2C5 D
      1G4
    }
  }
}
Generated notationNotation for the preceding Parts, voices, and measures example
Canonical spelling
scorescript 0.3
score "Two voices" {
  parts {
    violin
  }

  m1 {
    violin {
      2C5 D
      1G4
    }
  }
}

Measure 1 contains C5 and D5 as half notes above a whole-note G4. Both rows start at the same time. This is one measure, not two.

Scope matters: violin { m1 { ... } } is part-first. Putting the same two rows there advances through successive bars; it does not declare two voices. Use the measure-first arrangement above for simultaneous rows.

Do not assume that multiple voices automatically mean two separately extractable players, an ossia, or a piano grand staff. Those are distinct musical requirements. Multi-staff rh:/lh: notation is not part of this documented authoring surface.

Clefs and staff defaults

A catalog instrument supplies its usual clef: flute and piano start in treble, viola in alto, tuba in bass, and unpitched percussion in percussion clef. An anonymous fragment without a stated clef uses treble or bass according to its register; it does not acquire alto merely to reduce ledger lines.

State a clef in the part to override the default. An inline change applies from its containing measure onward, including when no opening clef was stated:

ScoreScript sourceDownload source
scorescript 0.3
score "Cello clefs" {
  parts { cello }
  cello {
    clef bass
    m1-2 { 1C3 | [clef tenor] 1C4 }
  }
}
Generated notationNotation for the preceding Parts, voices, and measures example
Canonical spelling
scorescript 0.3
score "Cello clefs" {
  parts {
    cello
  }

  cello {
    clef bass

    m1-2 {
      1C3 | [clef tenor] C'
    }
  }
}

Named clefs include treble, soprano, mezzo-soprano, alto, tenor, baritone, bass, and percussion. Octave-clef spellings include treble-8va, treble-8vb, bass-8va, and bass-8vb. An explicit clef is preserved; switching the output pitch does not erase your clef changes.

Written output keeps transposing players in their catalog reading clefs. Concert output may use a register-appropriate clef for octave-transposing instruments such as bass clarinet. Low written notes alone must not turn a bass-clarinet player's treble staff into a bass staff.

One declared part is one staff; simultaneous voices remain on that staff. piano does not automatically split a melody into right and left hands. Multiple systems are successive lines of music, not additional instruments. See left-side grouping for grouping existing staves without creating or redistributing music.

Silence, pickups, and names

In part-first source, gaps between explicitly addressed ranges are silent. A part that begins at m9 has eight preceding measures of rest. Check the range before changing it: deleting music and leaving its next addressed range can leave silence rather than renumber the score.

m0 addresses a pickup. =name gives a note or a measure an authored name.

ScoreScript sourceDownload source
scorescript 0.3
score "Pickup" {
  parts { flute }
  flute {
    m0 { 4G4 }
    m1=intro { 4C5=theme D E F }
  }
}
Generated notationNotation for the preceding Parts, voices, and measures example
Canonical spelling
scorescript 0.3
score "Pickup" {
  parts {
    flute
  }

  flute {
    m0-1 {
      4G4 | C=theme D E F
    }
  }
}

Measure ranges also support names and reuse; see shared passages. For multiple complete movements, use collections.

Compatibility spellings

Older files may contain part flute: Flute { m1: ... }, colon grids, or numbered voice N { ... } blocks. These remain accepted input; they are not the default examples for new files. The older direct part body does not accept all nested ranges, shared readers, and layout maps supported by the current roster-plus-body form.