Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SmoMeasure

Data for a measure of music. Many rules of musical engraving are enforced at a measure level: the duration of notes, accidentals, etc.

Measures contain SmoNote, SmoTuplet, and {@link SmoBeamGroup} Measures are contained in SmoSystemStaff

Hierarchy

  • SmoMeasure

Implements

Index

Constructors

Properties

activeVoice: number = 0

the active voice in the editor, if there are multiple voices

attrs: SmoAttrs

Information for identifying this object

Measure-specific formatting parameters.

measureNumber: MeasureNumber = ...

Row, column, and custom numbering information about this measure.

Runtime information about rendering

timeSignatureString: string = ''

Overrides display of actual time signature, in the case of pick-up notes where the actual and displayed durations are different

transposeIndex: number = 0

Adjust for non-concert pitch intstruments

Accessors

  • get staffWidth(): number
  • get staffX(): number
  • get staffY(): number
  • get yTop(): number
  • get defaultPitchForClef(): Record<Clef, Pitch>
  • When creating a new measure, the 'default' settings can vary depending on what comes before/after the measure. This determines the default pitch for a clef (appears on 3rd line)

    Returns Record<Clef, Pitch>

Methods

  • getForceSystemBreak(): boolean
  • getMaxTicksVoice(): number
  • getTicksFromVoice(voiceIndex: number): number
  • resetTempo(): void
  • serialize(): any
  • Convert this measure object to a JSON object, recursively serializing all the notes, note modifiers, etc.

    Returns any

  • setBox(box: SvgBox, description: string): void
  • setWidth(width: number, description: string): void
  • set the rendered width of the measure, or estimate of same

    Parameters

    • width: number
    • description: string

    Returns void

  • setX(x: number, description: string): void
  • setY(y: number, description: string): void
  • setYTop(y: number, description: string): void
  • Return actual or estimated highest point in score

    Parameters

    • y: number
    • description: string

    Returns void

  • transposeToOffset(offset: number, targetKey: string, newClef?: Clef): void
  • WHen setting an instrument, offset the pitches to match the instrument key

    Parameters

    • offset: number
    • targetKey: string
    • Optional newClef: Clef

    Returns void

  • restore a serialized measure object. Usually called as part of deserializing a score, but can also be used to restore a measure due to an undo operation. Recursively deserialize all the notes and modifiers to construct a new measure.

    Parameters

    • jsonObj: any

      the serialized SmoMeasure

    Returns SmoMeasure

  • When creating a new measure, the 'default' settings can vary depending on what comes before/after the measure. This determines the defaults from the parameters that are passed in, which could be another measure in the score. This version returns params with no notes, for callers that want to use their own notes. If you want the default notes, see getDefaultMeasureWithNotes

    Parameters

    Returns SmoMeasure

  • When creating a new measure, the 'default' settings can vary depending on what comes before/after the measure. This determines the defaults from the parameters that are passed in, which could be another measure in the score.

    Parameters

    Returns SmoMeasure

Generated using TypeDoc