Skip to main content
MRS-S and Working Set Envelopes serialize the same underlying data model. Working Sets simply extract a bounded subset of this model with context. See: /MRS-Specification-RFC#8-data-model

Core Entities

Score
├── Metadata: Map<String, Value>
├── Parts: OrderedMap<PartId, Part>
├── Measures: OrderedMap<UUID, Measure>
├── Spans: Set<Span>
├── Overlays: Set<Overlay> (optional)
└── Layout: LayoutHints (optional)

Measure
├── id: UUIDv7 (stable identity)
├── number: PositiveInt (display property)
├── beat-start: Rational (absolute position)
├── sec-start: Float? (if tempo automation)
├── time, key, tempo, rehearsal...
└── content: Map<PartId, PartContent>

Event
├── id: UUIDv7 (stable identity)
├── beat: Decimal (position in measure)
├── at: Rational (absolute position)
├── pitches: List<Pitch>
├── duration: Duration
└── properties: Map<String, Value>

Span
├── id: UUIDv7 (stable identity)
├── type: slur | tie | beam | hairpin | ...
├── from: UUIDv7 (event reference)
├── to: UUIDv7 (event reference)
└── properties: Map<String, Value>
See: /MRS-Specification-RFC#8-2-core-entities

Invariants

  1. Unique identifiers: No two measures, events, or spans share a UUID
  2. Display numbers: Measure numbers must be positive; may have gaps
  3. Beat bounds: Event beat positions must be ≥ 0 and < measure duration
  4. Duration sum: Voice durations should not exceed measure duration
  5. Tie pitch match: Tied notes must have identical pitch
  6. Span validity: Span endpoints must reference existing UUIDs
  7. Voice consistency: Events in a voice should not overlap temporally
  8. UUID immutability: Once assigned, an :id is immutable
  9. Dual positioning: Every event MUST have both beat and :at
  10. Measure identity: Every measure MUST have :id and :number
See: /MRS-Specification-RFC#8-3-invariants

Measure Identity

Measures have dual identity:
(measure 
  :id #uuid "018c3f40-002d-7890-abcd-ef1234567890"  ; Stable identity
  :number 45                                         ; Display property
  :beat-start 487+1/4
  ...)
  • :id — Used for all internal references, survives insertions/deletions
  • :number — For human navigation only, can change
See: /MRS-Specification-RFC#3-3-stable-identifiers

Temporal Model

MRS uses a dual positioning model: Structural positioning (measure-relative):
  • Beat 0 is the first beat of the measure
  • Used for human readability
Absolute positioning:
  • :at — Rational quarter-notes since part start
  • :sec — Seconds since start (if tempo automation)
  • Used for validation and meter-agnostic reasoning
All validation involving timing MUST use absolute positions. See: /MRS-Specification-RFC#8-4-temporal-model