MultiVoiceMeasure class

Measure with multiple independent voices

Used for polyphonic notetion where multiple melodic lines appear on the same staff simultaneously.

Example:

final measure = MultiVoiceMeasure();

// Voice 1 (melody, stems up)
final voice1 = Voice.voice1();
voice1.add(Note(pitch: Pitch(step: 'And', octave: 5), duration: ...));
measure.addVoice(voice1);

// Voice 2 (accompaniment, stems down)
final voice2 = Voice.voice2();
voice2.add(Note(pitch: Pitch(step: 'C', octave: 4), duration: ...));
measure.addVoice(voice2);
Inheritance

Constructors

MultiVoiceMeasure()
MultiVoiceMeasure.threeVoices({required List<MusicalElement> voice1Elements, required List<MusicalElement> voice2Elements, required List<MusicalElement> voice3Elements})
Factory: Create measure with 3 voices
factory
MultiVoiceMeasure.twoVoices({required List<MusicalElement> voice1Elements, required List<MusicalElement> voice2Elements})
Factory: Create measure with 2 voices
factory

Properties

autoBeaming bool
Controls whether notes should be automatically grouped with beams. true = auto-beaming active (default) false = use individual flags
getter/setter pairinherited
beamingMode BeamingMode
Specific beaming strategy for special cases.
getter/setter pairinherited
currentMusicalValue double
calculateTestes the total current rhythmic value of elements in the measure.
no setterinherited
elements List<MusicalElement>
All musical elements in this measure, in order.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
inheritedTimeSignature TimeSignature?
Time signature inherited from a previous measure (used for preventive validation).
getter/setter pairinherited
isPolyphonic bool
Check if measure has multiple voices (is polyphonic)
no setter
isValidlyFilled bool
Returns true if the measure is correctly filled.
no setterinherited
manualBeamGroups List<List<int>>
Manual beam groups — list of note index groups to be beamed together. Example: [0, 1, 2, 3, 4] groups notes 0,1,2 into one beam and 3,4 into another.
getter/setter pairinherited
number int?
Measure number, corresponding to the MEI <measure @n> attribute. null = automatic numbering by the layout engine.
getter/setter pairinherited
remainingValue double
Returns how much rhythmic time remains in the measure.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
sortedVoices List<Voice>
Get all voices sorted by voice number
no setter
timeSignature TimeSignature?
Returns the active time signature for this measure.
no setterinherited
voice1 Voice?
Get voice 1 (top voice)
no setter
voice2 Voice?
Get voice 2 (bottom voice)
no setter
voiceCount int
Get number of voices in this measure
no setter
voiceNumbers List<int>
Get list of voice numbers (sorted)
no setter
voices Iterable<Voice>
Collection de voices (ordenação not garantida).
no setter

Methods

add(MusicalElement element) → void
Adds a musical element to the measure.
inherited
addVoice(Voice voice) → void
Add a voice to this measure
canAddDuration(Duration duration) bool
Returns true if there is room to add the given duration.
inherited
getVoice(int number) Voice?
Get voice by number
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited