Skip to main content
See: /MRS-Specification-RFC#4-mrs-s-the-canonical-storage-format

Spans Section

Spans define relationships between events across time. All endpoints use UUID references.
(spans
  (slur
    :id #uuid "018c3f2c-0001-..."
    :from #uuid "018c3f2a-0001-..."
    :to #uuid "018c3f2a-0004-...")
  
  (hairpin
    :id #uuid "018c3f2c-0002-..."
    :type crescendo
    :from #uuid "018c3f2a-0001-..."
    :to #uuid "018c3f2a-0008-...")
  
  (beam
    :id #uuid "018c3f2c-0003-..."
    :events [#uuid "018c3f2a-0005-..." 
             #uuid "018c3f2a-0006-..."
             #uuid "018c3f2a-0007-..."]))

Span Types

TypeEndpoint StyleDescription
slurfrom/toPhrasing slur
tiefrom/toTie between same pitches
hairpinfrom/toCrescendo/diminuendo
beamevents listBeam grouping
ottavafrom/toOctave transposition
pedalfrom/toPiano pedal
trill-spanfrom/toExtended trill line
glissfrom/toGlissando line
voltafrom/toEnding bracket

Span Attributes

(slur
  :id #uuid "..."
  :from #uuid "..."
  :to #uuid "..."
  :style legato)          ; Optional style

(hairpin
  :id #uuid "..."
  :type crescendo         ; crescendo or diminuendo
  :from #uuid "..."
  :to #uuid "...")

(beam
  :id #uuid "..."
  :events [#uuid "..." #uuid "..." #uuid "..."]
  :feather accelerando)   ; Optional feathered beam

Span Immutability

Once created, span endpoints (:from, :to, :events) are immutable. To change endpoints, delete the span and create a new one.

Boundary Markers

For spans that cross Working Set boundaries:
(slur
  :id #uuid "..."
  :from #uuid "..."        ; Inside scope
  :to #uuid "..."          ; Outside scope
  :boundary-exit true)     ; Marks endpoint outside
MarkerMeaning
:boundary-entry trueSpan starts outside, ends inside
:boundary-exit trueSpan starts inside, ends outside
Boundary-marked spans are read-only at their boundary endpoints.

Directions

Directions are measure-level or instrument-level instructions.

Measure-Level Directions

(measure :id #uuid "..." :number 45
  (dir :type tempo :beat 0 :text "Più mosso" :tempo 132)
  (dir :type dynamic :beat 0 :text "ff" :scope all)
  (dir :type rehearsal :beat 0 :text "B")
  (dir :type text :beat 2 :text "poco rit." :placement above)
  (dir :type segno :beat 0)
  (dir :type coda :beat 0)
  (dir :type fine :beat 0)
  (dir :type dc :beat 0 :text "D.C. al Coda")
  
  (flute-1 ...))

Instrument-Level Directions

(measure :id #uuid "..." :number 45
  (flute-1
    (dir :type text :beat 0 :text "sul G" :placement above)
    (v1 ...)))

Direction Types

TypeDescription
tempoTempo marking
dynamicDynamic marking (score-wide)
rehearsalRehearsal mark
textText instruction
segnoSegno sign
codaCoda sign
fineFine marking
dcD.C. (da capo)
dsD.S. (dal segno)

Movements

Multi-movement works use the movements structure:
(movements
  (movement 1 :title "Allegro" :key C :mode major :time 4/4
    (measures
      (measure :id #uuid "..." :number 1 ...) 
      ...))
  
  (movement 2 :title "Adagio" :key F :mode major :time 3/4
    (measures
      (measure :id #uuid "..." :number 1 ...) 
      ...))
  
  (movement 3 :title "Finale" :key C :mode major :time 2/4
    (measures
      (measure :id #uuid "..." :number 1 ...) 
      ...)))
Measure numbers restart in each movement. UUIDs remain globally unique.

Alternatives (Ossia, Variants)

(alternatives
  (ossia
    :measures [#uuid "..." #uuid "..."]
    :instrument flute-1
    :label "easier version"
    :content
      (measures
        (measure :id #uuid "..." :number 123 ...)))
  
  (variant
    :measures [#uuid "..."]
    :label "manuscript variant"
    :source "autograph ms."
    :content ...))

Alternative Types

TypePurpose
ossiaAlternative passage (usually easier)
variantSource variant (editorial)
editorialEditorial suggestion

Layout Hints (Optional)

Layout hints are NON-NORMATIVE suggestions for rendering:
(layout
  :bar-numbers (every 5)
  :multi-rest-style consolidated
  
  (break :type system :after #uuid "018c3f40-0008-...")
  (break :type page :after #uuid "018c3f40-0020-...")
  
  (hide-empty-staves true)
  
  (condense 
    :instruments [flute-1 flute-2]
    :measures [#uuid "..." #uuid "..."]
    :label "Fl. 1, 2"))

Layout Elements

ElementDescription
breakSystem or page break
hide-empty-stavesHide staves with rests
condenseCombine instruments on one staff
spacingMeasure spacing hints
Layout hints do not affect playback or semantic content.