# 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
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
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.

Keep a newline after the outer measure-first header (`m1-2 {`) before the
instrument rows. Do not flatten it into `m1-2 { fl { ... } }`. 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](normalization.md), 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.

### 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
10. 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
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.

## 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
scorescript 0.3
score "Pickup" {
  parts { flute }
  flute {
    m0 { 4G4 }
    m1=intro { 4C5=theme D E F }
  }
}
```

Measure ranges also support names and reuse; see [shared passages](reuse.md).
For multiple complete movements, use [collections](collections.md).

## 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.
