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

- SmoMeasureParams
- TickMappable

## Index

### Constructors

- constructor

### Properties

- activeVoice
- attrs
- format
- measureNumber
- svg
- timeSignatureString
- transposeIndex

### Accessors

- staffWidth
- staffX
- staffY
- yTop
- defaultPitchForClef
- defaults

### Methods

- addMeasureText
- getForceSystemBreak
- getMaxTicksVoice
- getTicksFromVoice
- resetTempo
- serialize
- setBox
- setWidth
- setX
- setY
- setYTop
- transposeToOffset
- deserialize
- getDefaultMeasure
- getDefaultMeasureWithNotes
- getDefaultNotes
- timeSigEqual

## Constructors

### constructor

- new SmoMeasure(params: SmoMeasureParams): SmoMeasure

- - Defined in src/smo/data/measure.ts:278

  Fill in components. We assume the modifiers are already constructed, e.g. by deserialize or the calling function.

  #### Parameters

  - ##### params: SmoMeasureParams

  #### Returns SmoMeasure

## Properties

### activeVoice

activeVoice: number = 0

Implementation of SmoMeasureParams.activeVoice

- Defined in src/smo/data/measure.ts:256

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

### attrs

attrs: SmoAttrs

- Defined in src/smo/data/measure.ts:271

Information for identifying this object

### format

format: SmoMeasureFormat

Implementation of SmoMeasureParams.format

- Defined in src/smo/data/measure.ts:267

Measure-specific formatting parameters.

### measureNumber

measureNumber: MeasureNumber = ...

Implementation of SmoMeasureParams.measureNumber

- Defined in src/smo/data/measure.ts:245

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

### svg

svg: MeasureSvg

- Defined in src/smo/data/measure.ts:263

Runtime information about rendering

### timeSignatureString

timeSignatureString: string = ''

Implementation of SmoMeasureParams.timeSignatureString

- Defined in src/smo/data/measure.ts:232

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

### transposeIndex

transposeIndex: number = 0

Implementation of SmoMeasureParams.transposeIndex

- Defined in src/smo/data/measure.ts:240

Adjust for non-concert pitch intstruments

## Accessors

### staffWidth

- get staffWidth(): number

- - Defined in src/smo/data/measure.ts:720

  The rendered width of the measure, or estimate of same

  #### Returns number

### staffX

- get staffX(): number

- - Defined in src/smo/data/measure.ts:740

  Get rendered or estimated start x

  #### Returns number

### staffY

- get staffY(): number

- Implementation of SmoMeasureParams.staffY

  - Defined in src/smo/data/measure.ts:758

  Get rendered or estimated start y

  #### Returns number

### yTop

- get yTop(): number

- - Defined in src/smo/data/measure.ts:776

  Return actual or estimated highest point in score

  #### Returns number

### Static defaultPitchForClef

- get defaultPitchForClef(): Record<Clef, Pitch>

- - Defined in src/smo/data/measure.ts:525

  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>

### Static defaults

- get defaults(): SmoMeasureParams

- - Defined in src/smo/data/measure.ts:207

  Default constructor parameters. Defaults are always copied so the caller can modify them to create a new measure.

  #### Returns SmoMeasureParams

  constructor params for a new measure

## Methods

### addMeasureText

- addMeasureText(mod: SmoMeasureModifierBase): void

- - Defined in src/smo/data/measure.ts:1146

  Measure text is deprecated, and may not be supported in the future. Better to use SmoTextGroup and attach to the measure.

  #### Parameters

  - ##### mod: SmoMeasureModifierBase

  #### Returns void

### getForceSystemBreak

- getForceSystemBreak(): boolean

- - Defined in src/smo/data/measure.ts:685

  used by xml export

  internal

  #### Returns boolean

### getMaxTicksVoice

- getMaxTicksVoice(): number

- - Defined in src/smo/data/measure.ts:929

  Count the number of ticks in each voice and return max

  #### Returns number

### getTicksFromVoice

- getTicksFromVoice(voiceIndex: number): number

- - Defined in src/smo/data/measure.ts:944

  Count the number of ticks in a specific voice

  #### Parameters

  - ##### voiceIndex: number

  #### Returns number

### resetTempo

- resetTempo(): void

- - Defined in src/smo/data/measure.ts:1131

  Set measure tempo to the default SmoTempoText

  #### Returns void

### serialize

- serialize(): any

- - Defined in src/smo/data/measure.ts:403

  Convert this measure object to a JSON object, recursively serializing all the notes, note modifiers, etc.

  #### Returns any

### setBox

- setBox(box: SvgBox, description: string): void

- - Defined in src/smo/data/measure.ts:816

  Return actual or estimated bounding box

  #### Parameters

  - ##### box: SvgBox

  - ##### description: string

  #### Returns void

### setWidth

- setWidth(width: number, description: string): void

- - Defined in src/smo/data/measure.ts:727

  set the rendered width of the measure, or estimate of same

  #### Parameters

  - ##### width: number

  - ##### description: string

  #### Returns void

### setX

- setX(x: number, description: string): void

- - Defined in src/smo/data/measure.ts:747

  Set rendered or estimated start x

  #### Parameters

  - ##### x: number

  - ##### description: string

  #### Returns void

### setY

- setY(y: number, description: string): void

- - Defined in src/smo/data/measure.ts:765

  Set rendered or estimated start y

  #### Parameters

  - ##### y: number

  - ##### description: string

  #### Returns void

### setYTop

- setYTop(y: number, description: string): void

- - Defined in src/smo/data/measure.ts:808

  Return actual or estimated highest point in score

  #### Parameters

  - ##### y: number

  - ##### description: string

  #### Returns void

### transposeToOffset

- transposeToOffset(offset: number, targetKey: string, newClef?: Clef): void

- - Defined in src/smo/data/measure.ts:785

  WHen setting an instrument, offset the pitches to match the instrument key

  #### Parameters

  - ##### offset: number

  - ##### targetKey: string

  - ##### Optional newClef: Clef

  #### Returns void

### Static deserialize

- deserialize(jsonObj: any): SmoMeasure

- - Defined in src/smo/data/measure.ts:459

  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

### Static getDefaultMeasure

- getDefaultMeasure(params: SmoMeasureParams): SmoMeasure

- - Defined in src/smo/data/measure.ts:644

  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

  - ##### params: SmoMeasureParams

  #### Returns SmoMeasure

### Static getDefaultMeasureWithNotes

- getDefaultMeasureWithNotes(params: SmoMeasureParams): SmoMeasure

- - Defined in src/smo/data/measure.ts:670

  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

  - ##### params: SmoMeasureParams

  #### Returns SmoMeasure

### Static getDefaultNotes

- getDefaultNotes(params: SmoMeasureParams): SmoNote[]

- - Defined in src/smo/data/measure.ts:630

  Get a measure full of default notes for a given timeSignature/clef. returns 8th notes for triple-time meters, etc.

  #### Parameters

  - ##### params: SmoMeasureParams

  #### Returns SmoNote[]

### Static timeSigEqual

- timeSigEqual(o1: TimeSignature, o2: TimeSignature): boolean

- - Defined in src/smo/data/measure.ts:381

  // Return true if the time signatures are the same, for display purposes (e.g. if a time sig change // is required)

  #### Parameters

  - ##### o1: TimeSignature

  - ##### o2: TimeSignature

  #### Returns boolean

Generated using TypeDoc