MeasureDef

class maelzel.scorestruct.MeasureDef(timesig, quarterTempo, parent, annotation='', timesigInherited=False, tempoInherited=False, barline='', rehearsalMark=None, keySignature=None, properties=None, maxEighthTempo=48, readonly=True)[source]

Bases: object

A MeasureDef defines one Measure within a ScoreStruct (time signature, tempo, etc.)

Attributes Summary

annotation

Any text annotation for this measure

barline

The barline style, or '' to use default

durationQuarters

The duration of this measure in quarter-notes

durationSecs

The duration of this measure in seconds

keySignature

If given, a key signature

maxEighthTempo

The max.

parent

The parent ScoreStruct of this measure, if any

properties

User defined properties can be placed here.

quarterTempo

The tempo relative to a quarternote

readonly

Is this measure definition read only?

rehearsalMark

If given, a RehearsalMark for this measure

tempoInherited

Is the tempo of this measure inherited?

timesig

The time signature of this measure.

timesigInherited

Is the time-signature of this measure inherited?

Methods Summary

asScoreLine()

The representation of this MeasureDef as a score line

beatStructure()

Beat structure of this measure

copy()

rtype:

MeasureDef

subdivisionStructure()

Max.

subdivisions()

Returns a list of the durations representing the subdivisions of this measure.

timesigRepr()

Returns a string representation of this measure's time signature

Attributes Documentation

annotation

Any text annotation for this measure

barline

The barline style, or ‘’ to use default

durationQuarters

The duration of this measure in quarter-notes

durationSecs

The duration of this measure in seconds

keySignature

If given, a key signature

maxEighthTempo: int

The max. tempo at which an eighth note can be a beat of its own

parent

The parent ScoreStruct of this measure, if any

properties

User defined properties can be placed here. None by default

quarterTempo

The tempo relative to a quarternote

readonly

Is this measure definition read only?

rehearsalMark

If given, a RehearsalMark for this measure

tempoInherited

Is the tempo of this measure inherited?

timesig

The time signature of this measure. Can be explicit or inherited

timesigInherited

Is the time-signature of this measure inherited?

Methods Documentation

asScoreLine()[source]

The representation of this MeasureDef as a score line

Return type:

str

beatStructure()[source]

Beat structure of this measure

Returns:

F, beatDur: F, beatWeight: int) for each beat of this measure

Return type:

a list of tuple with the form (beatOffset

copy()[source]
Return type:

MeasureDef

subdivisionStructure()[source]

Max. common denominator for subdivisions and the subdivisions as multiples of it

For example, for 3/4+3/8, returns (8, (2, 2, 2, 3))

Return type:

tuple[int, tuple[int, ...]]

Returns:

a tuple (max. common denominator, subdivisions as multiples of common denominator)

subdivisions()[source]

Returns a list of the durations representing the subdivisions of this measure.

A subdivision is a duration, in quarters.

Return type:

list[Fraction]

Returns:

a list of durations which sum up to the duration of this measure

Example

>>> MeasureDef(timesig=TimeSignature((3, 4)), quarterTempo=60).subdivisions()
[1, 1, 1]
>>> MeasureDef(timesig=TimeSignature((3, 8)), quarterTempo=60).subdivisions()
[0.5, 0.5, 0.5]
>>> MeasureDef(timesig=TimeSignature((7, 8)), quarterTempo=40).subdivisions()
[0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5]
>>> MeasureDef(timesig=TimeSignature((7, 8)), quarterTempo=150).subdivisions()
[1.0, 1.0, 1.5]
>>> MeasureDef(TimeSignature((7, 8), subdivisionStruct=(2, 3, 2)), quarterTempo=150).subdivisions()
[1, 1.5, 1]
timesigRepr()[source]

Returns a string representation of this measure’s time signature

Return type:

str

Returns:

a string representation of this measure’s time-signature