Notation¶
- class maelzel.scoring.Notation(duration, pitches, offset=None, isRest=False, tiedPrev=False, tiedNext=False, dynamic='', durRatios=(), group='', gliss=False, properties=None, fixNotenames=False, _init=True)[source]¶
Bases:
objectThis represents a notation (a rest, a note or a chord)
- Parameters:
duration (
Union[int,float,Fraction]) – the duration of this Notation, in quarter-notes. 0 indicates a grace notepitches (
Sequence[Union[int,float,str]]) – if given, a list of pitches as midinote or notename.offset (
Union[int,float,Fraction,None]) – the offset of this Notation, in quarter-notes.isRest – is this a rest?
tiedPrev – is this Notation tied to the previous one?
tiedNext – is it tied to the next
dynamic (
str) – the dynamic of this notation, one of “p”, “pp”, “f”, etc.group – a str identification, can be used to group Notations together
durRatios (
tuple[Fraction,...]) – a list of tuples (x, y) indicating a tuple relationship. For example, a Notation used to represent one 8th note in a triplet would have the duration 1/3 and durRatios=[(3, 2)]. Multiplying the duration by the durRatios would result in the notated value, in this case 1/2 (1 being a quarter note). A value of None is the same as a value of [(1, 1)] (no modification)gliss – if True, a glissando will be rendered between this note and the next
fixNotenames – if True, pitches given as strings are fixed to the given spelling
Attributes Summary
Attachments are gathered here
A set of ratios to apply to .duration to convert it to its notated duration
The duration of this Notation, in quarternotes
A dynamic mark
The end time of this notation.
A dict mapping pitch index to spelling
Is this Notation part of a glissando?
The group id this Notation belongs to, if applicable
Is this a gracenote?
A real note is not a rest and not a gracenote
Is this a Rest?
Is this Notation stemless?
Can this Notation be merged with a next Notation
Can this Notation be merged with a previous Notation
A dict mapping pitch index to notehead definition
The start time in quarternotes
The pitches of this Notation (without spelling, just midinotes)
A dict of user properties.
Quantized offset, raises ValueError if this notation is not quantized
A list of spanners this Notations is part of
Is this Notation tied to the next one?
Is this Notation tied to the previous one?
Methods Summary
accidentalDirection([index, minAlteration])Returns the direction of the alteration in this notation
addArticulation(articulation[, color, placement])Add an articulation to this Notation.
addAttachment(attachment[, pitchanchor])Add an attachment to this Notation
addSpanner(spanner[, end])Add a Spanner to this Notation
addText(text[, placement, fontsize, italic, ...])Add a text annotation to this Notation.
asRest([dynamic])Clone this Notations as a rest
breakIrregularDurationInNode(beatstruct)canMergeWith(n1)Returns True if self and n1 can be merged
checkIntegrity([fix])Checks the integrity of self
Remove any fixed enharmonic spelling set for this notation
clone([copyFixedNotenames, spanners])Clone this Notation, overriding any value.
cloneAsTie(duration, offset[, tiedPrev, ...])Clone self so that the cloned Notation can be used within a logical tie
copy([spanners])Copy this Notation
copyAttachmentsTo(dest)Copy any attachments in self to dest Notation
copyAttributesTo(dest[, spelling])Copy attributes of self to dest
copyFixedSpellingTo(other)Copy fixed spelling to other
delProperty(key)Remove the given property
extractPartialNotation(indexes[, spanners])Extract part of a chord with any attachments corresponding to the given pitches
findAttachment(cls[, pitchanchor])Find an attachment by class or classname
findSpanner(uuid[, kind])Find a spanner with the given attributes
fixNotename(notename[, index])Fix the spelling for the pitch at index inplace
fixedSlots([semitoneDivs])Calculate the fixed slots within this chord
The fused duration ratio of this notation
getAttachments([cls, predicate, anchor])Get a list of Attachments matching the given criteria
getFixedNotename([idx])Returns the fixed notename of this notation, if any
getNotehead([index])Get a Notehead by index
getProperty(key[, default, setdefault])Get the value of a property.
getTieHint(idx[, direction])True if the pitch with the given idx has a tie hint set
True if this notation has information attached
Does this notations have a regular duration?
hasSpanner(uuid[, kind])Returns true if a spanner with the given uuid is found
Is this Notation quantized?
makeArtificialHarmonic(basepitch, interval, ...)Create a Notation representing an artificial harmonic
makeChord(pitches, duration[, offset, ...])Utility function to create a chord Notation
makeNote(pitch, duration[, offset, ...])makeRest(duration[, offset, dynamic, annotation])Shortcut function to create a rest notation.
The mean pitch of this note/chord
mergeNotationsIfPossible(notations)Merge the given notations into one, if possible.
mergeWith(other[, check])Merge this Notation with
otherThe duration of the notated figure as a NotatedDuration
notename([index, addExplicitMark])Returns the notename corresponding to the given pitch index
pitchclassIndex([semitoneDivs, index])The index of the nearest pitch/microtone
quantizedPitches([divs])Quantize the pitches of this Notation
removeAttachments(predicate)Remove attachments where predicate is True
Remove attachments which match the given class
removeSpanner(spanner)Removes the given spanner from this Notation
Remove all spanners from this Notation
resolveHarmonic([removeAttachment])Realize an artificial harmonic as a chord with the corresponding noteheads
resolveNotenames([addFixedAnnotation, ...])Resolve the enharmonic spellings for this Notation
setNotehead(notehead[, index, merge])Set a notehead in this notation
setPitches(pitches[, fixNotenames])Set the pitches of this notation, in place
setProperty(key, value)Set any property of this Notation.
setTieHint(idx[, direction])Set a tie hint for a specific pitch in this notation
splitAtOffset(offset[, tie, nomerge])Split this notations at the given offset
splitAtOffsets(offsets[, nomerge])Splits a Notation at the given offsets
splitNotationsAtOffsets(notations, offsets)Split notations at the given offsets.
The symbolic duration of this Notation.
tieHints([direction, clear])Get any tie hints set
tieNotations(notations)tiedPitches([direction])The list of tied pitches or None if not tied or ties not set
transferSpanner(spanner, other)Move the given spanner to another Notation
verticalPosition([index])The vertical position of the notated note at given index
Attributes Documentation
-
attachments:
list[Attachment] |None¶ Attachments are gathered here
- color¶
-
durRatios:
tuple[Fraction,...]¶ A set of ratios to apply to .duration to convert it to its notated duration
-
duration:
Fraction¶ The duration of this Notation, in quarternotes
-
dynamic:
str¶ A dynamic mark
- end¶
The end time of this notation.
Raises an exception if this Notation has no offset
-
fixedNotenames:
dict[int,str] |None¶ A dict mapping pitch index to spelling
-
gliss:
bool¶ Is this Notation part of a glissando?
-
groupid:
str¶ The group id this Notation belongs to, if applicable
- isGracenote¶
Is this a gracenote?
- isRealnote¶
A real note is not a rest and not a gracenote
-
isRest:
bool¶ Is this a Rest?
- isStemless¶
Is this Notation stemless?
This property can be set by adding a StemTraits attachment
- mergeableNext¶
Can this Notation be merged with a next Notation
- mergeablePrev¶
Can this Notation be merged with a previous Notation
-
noteheads:
dict[int,Notehead] |None¶ A dict mapping pitch index to notehead definition
-
offset:
Fraction|None¶ The start time in quarternotes
-
pitches:
tuple[float|int,...]¶ The pitches of this Notation (without spelling, just midinotes)
-
properties:
dict[str,Any] |None¶ A dict of user properties. To be set via setProperty
- qoffset¶
Quantized offset, raises ValueError if this notation is not quantized
- sizeFactor¶
-
spanners:
list[Spanner] |None¶ A list of spanners this Notations is part of
- stem¶
-
tiedNext:
bool¶ Is this Notation tied to the next one?
-
tiedPrev:
bool¶ Is this Notation tied to the previous one?
Methods Documentation
- accidentalDirection(index=0, minAlteration=0.5)[source]¶
Returns the direction of the alteration in this notation
- Parameters:
index – index of the pitch within this Notation
minAlteration – threshold (with minAlteration 0.5 C+ gets a direction of +1, whereas C+25 still gets a direction of 0)
- Return type:
int- Returns:
one of -1, 0 or +1, corresponding to the direction of the alteration (flat, natural or sharp)
- addArticulation(articulation, color='', placement='')[source]¶
Add an articulation to this Notation.
See
definitions.articulationsfor possible values. We understand articulation in a broad sense as any symbol attached to a note/chord- Parameters:
articulation (
str|Articulation) – an Articulation object, or one of accent, staccato, tenuto,marcato
staccatissimo
espressivo
portato
arpeggio
upbow
:param : :param downbow: :param flageolet: :param open: :param closed: :param stopped: :param snappizz: :type color: :param color: if given, color of the articulation :type placement: :param placement: one of ‘above’, ‘below’. If not given, the default placement
for the given articulation is used
- Return type:
- Returns:
self
- addAttachment(attachment, pitchanchor=None)[source]¶
Add an attachment to this Notation
An attachment is any kind of note attached symbol or text expression (a Fermata, a Text, an Articulation, an Ornament, etc.). To add a spanner (a slur, a bracket, etc.) see addSpanner.
Note
Some kinds of attachments are exclusive. Adding an exclusive attachment (like a certain text) will remove any previous such attachment.
- Parameters:
attachment (
Attachment) – an instance of scoring.attachment.Attachmentpitchanchor (
Optional[int]) – for pitch anchored symbols, the index of the pitch to add this attachment to. Alternatively the anchor can be set in the attachment itself
- Return type:
- Returns:
self
- addSpanner(spanner, end=None)[source]¶
Add a Spanner to this Notation
Spanners always are bound in pairs. A ‘start’ spanner is attached to one Notation, an ‘end’ spanner with the same uuid is attached to the notation where the spanner should end (see
Spanner.bind())
- addText(text, placement='above', fontsize=None, italic=False, weight='normal', fontfamily='', box=False, exclusive=False, role='', relativeSize=False)[source]¶
Add a text annotation to this Notation.
- Parameters:
text (
str|Text) – the text of the annotation, or a Text object itself If passed a Text objecj, all other parameters will not be consideredplacement – where to place the text annotation, one of ‘above’ or ‘below’
fontsize (
Union[int,float,None]) – the size of the fontbox (
str|bool) – if True, the text is enclosed in a box. A string indicates the shape of the boxitalic – if True, use italic style
weight – one of ‘normal’, ‘bold’
fontfamily – the font used
role – either unset or one of ‘measure’, …
exclusive – if True, only one text annotation with the given text and attributes is allowed. This enables to set a given text for a Notation without needing to check at the callsite that this text is already present
relativeSize – if True, the font size is relative to the staff size
- Return type:
None
- asRest(dynamic=False)[source]¶
Clone this Notations as a rest
- Parameters:
dynamic – if True, add a dynamic to the rest if self has a dynamic
- Return type:
- Returns:
a notation representing a rest with the same offset, duration and any other attribute set for this notation which can be applied to a rest
- canMergeWith(n1)[source]¶
Returns True if self and n1 can be merged
Two Notations can merge if they are quantized and the resulting duration is regular. A regular duration is one which can be represented via one notation (a quarter, a half, a dotted 8th, a double dotted 16th are all regular durations, 5/8 of a quarter is not)
- Return type:
bool
- checkIntegrity(fix=False)[source]¶
Checks the integrity of self
- Parameters:
fix – if True, attempts to fix the probelms found, if possible
- Return type:
list[str]- Returns:
a list of error messages
- clearFixedNotenames()[source]¶
Remove any fixed enharmonic spelling set for this notation
- Return type:
None
- clone(copyFixedNotenames=True, spanners=True, **kws)[source]¶
Clone this Notation, overriding any value.
- Parameters:
copyFixedNotenames – transfer any fixed notenames to the cloned notation
kws – keyword arguments, as passed to the Notation constructor. Any parameter given will override the corresponding value in this Notation
- Return type:
- cloneAsTie(duration, offset, tiedPrev=True, tiedNext=None, gliss=None)[source]¶
Clone self so that the cloned Notation can be used within a logical tie
The returned notation is thought to be tied to self, as a continuation. This is used when a notation is split across a measure or a beam or within a tuplet
- Return type:
- Returns:
The cloned Notation
- delProperty(key)[source]¶
Remove the given property
- Parameters:
key (
str) – the key to remove- Return type:
None
- extractPartialNotation(indexes, spanners=True)[source]¶
Extract part of a chord with any attachments corresponding to the given pitches
- Parameters:
indexes (
list[int]) – the indexes of the pitches to extractspanners – add any spanners in self to the extracted notation
- Return type:
- Returns:
a new Notation with the given pitches
- findAttachment(cls, pitchanchor=UNSET)[source]¶
Find an attachment by class or classname
Similar to getAttachments, returns only one attachment or None
- Parameters:
cls (
type[TypeVar(AttachmentT, bound=Attachment)]) – the class to match (the class itself or its name, case is not relevant)pitchanchor (
int|None|UnsetType) – if given, the anchor index to match. Some attachments are anchored to None, meaning they are anchored to the entire Notation and not a specific pitch. For example, an AccidentalTrait which applies to an entire chord (for example, to force accidentals or set colors) can be anchored to None Setting this argument to None will filter out an AccidentalTrait anchored to a specific pitch.
- Return type:
Optional[TypeVar(AttachmentT, bound=Attachment)]- Returns:
an Attachment matching the given criteria, or None
- findSpanner(uuid, kind='')[source]¶
Find a spanner with the given attributes
- Parameters:
uuid (
str) – the uuid of the spannerkind – the kind of the spanner, one of ‘start’ / ‘end’
- Return type:
Spanner|None
- fixNotename(notename, index=None)[source]¶
Fix the spelling for the pitch at index inplace
- Parameters:
notename (
str) – if given, it will be fixed to the given notename. If nothing is given, it will be fixed to n2m(self.pitches[idx])index (
Optional[int]) – the index of the note to modify. If None, a matching pitch in this notation is searched. ValueError is raised if no pitch is found
- Return type:
None
See also
Notation.notenames()
- fixedSlots(semitoneDivs=2)[source]¶
Calculate the fixed slots within this chord
- Parameters:
semitoneDivs – the number of divisions of the semitone.
- Return type:
dict[int,int] |None- Returns:
a dict mapping slot to alteration direction
- fusedDurRatio()[source]¶
The fused duration ratio of this notation
This is the result of applying all duration ratios this notation may have. This operation is only valid for quantized notations and will raise ValueError otherwise.
- Return type:
Fraction- Returns:
the fused duration ratio
- Raises:
ValueError – if this notation is not quantized
See also
- getAttachments(cls='', predicate=None, anchor=UNSET)[source]¶
Get a list of Attachments matching the given criteria
- Parameters:
cls (
str|type) – the class to match (the class itself or its name, case is not relevant)predicate (
Optional[Callable]) – a function (attachment) -> boolanchor (
int|None|UnsetType) – if given, the anchor index to match. Some attachments are anchored to a specific component (pitch) in the notation (for example a notehead or an accidental trait are attached to a specific pitch of the chord)
- Return type:
list[Attachment]- Returns:
the list of attachments matching the given criteria
- getFixedNotename(idx=0)[source]¶
Returns the fixed notename of this notation, if any
- Parameters:
idx (
int) – 0 in the case of a note, the index of the note if representing a chord- Return type:
str|None- Returns:
the fixed spelling of the note, if exists (None otherwise)
- getNotehead(index=0)[source]¶
Get a Notehead by index
- Parameters:
index – the notehead index. This corresponds to the pitch index in self.pitches
- Return type:
Notehead|None- Returns:
the Notehead or None if not defined
- getProperty(key, default=None, setdefault=None)[source]¶
Get the value of a property.
- Parameters:
key (
str) – the key to querysetdefault – if given, sets properties[key] = value if not already set
default – like setdefault but never modifies the actual properties
- Return type:
Any- Returns:
the value of the given property, or a fallback value
- getTieHint(idx, direction='forward')[source]¶
True if the pitch with the given idx has a tie hint set
- Parameters:
idx (
int) – the index of the pitchdirection – one of “forward or “backward”
- Return type:
bool
- hasAttributes()[source]¶
True if this notation has information attached
Information is any dynanic, attachments, spanners, etc.
- Return type:
bool
- hasRegularDuration()[source]¶
Does this notations have a regular duration?
This is only valid if the notation has been quantized.
- Return type:
bool- Returns:
True is the duration of this Notation is regular (the symbolic duration can be represented by ONE rhythmic figure, ie a ¼ note, ⅛ note, etc., with or without dots. This is independent of the notation beeing part of a tuplet.
- Raises:
ValueError – if the notation has not been quantized
- hasSpanner(uuid, kind='')[source]¶
Returns true if a spanner with the given uuid is found
- Return type:
bool
- classmethod makeArtificialHarmonic(basepitch, interval, **kws)[source]¶
Create a Notation representing an artificial harmonic
This is mainly circumscribed to string instruments
- Parameters:
basepitch (
Union[int,float,str]) – the pitch to press downinterval (
int) – the interval over the base pitch**kws – any kws passed to the Notation constructor
- Return type:
- Returns:
a chord representing the given artificial harmonic, consisting of two pitches, the base pitch and the half pressed pitch, where the higher pitch has a harmonic notehead. In both cases the enharmonic spelling is fixed in order to keep the interval
- classmethod makeChord(pitches, duration, offset=None, annotation='', dynamic='', fixed=False, **kws)[source]¶
Utility function to create a chord Notation
- Parameters:
pitches (
Sequence[Union[int,float,str]]) – the pitches as midinotes or notenames. If given a note as str, the note in question is fixed at the given enharmonic representation.duration (
Union[int,float,Fraction]) – the duration of this Notation. Use 0 to create a chord grace noteoffset (
Union[int,float,Fraction,None]) – the offset of this Notation (None to leave unset)annotation (
str|Text) – a text annotationdynamic – a dynamic for this chord
fixed – if True, fix the spelling of any pitch given as notename
**kws – any keyword accepted by Notation
- Return type:
- Returns:
the created Notation
- classmethod makeNote(pitch, duration, offset=None, annotation='', gliss=False, withId=False, enharmonicSpelling='', dynamic='', **kws)[source]¶
- Return type:
- classmethod makeRest(duration, offset=None, dynamic='', annotation='')[source]¶
Shortcut function to create a rest notation.
A rest is only needed when stacking notations within a container like Chain or Track, to signal a spacing between notations. Just explicitely setting the offset of a notation has the same effect
- Parameters:
duration (
Union[int,float,Fraction]) – the duration of the restoffset (
Union[int,float,Fraction,None]) – the start time of the rest. Normally a rest’s offset is left unspecified (None)dynamic (
str) – if given, attach this dynamic to the restannotation (
str) – if given, attach this text annotation to the rest
- Return type:
- Returns:
the created rest (a Notation)
- meanPitch()[source]¶
The mean pitch of this note/chord
This is provided to have a generalized way of quering the pitch of a note/chord for packing
- Return type:
float- Returns:
the pitchof this note or the avg. pitch if it is a chord. Rests do not have a mean pitch and calling this on a rest will raise ValueError
- static mergeNotationsIfPossible(notations)[source]¶
Merge the given notations into one, if possible.
Notations which cannot be merged are added to the returned list
If two consecutive notations have same .durRatio and merging them would result in a regular note, merge them:
8 + 8 = q q + 8 = q· q + q = h 16 + 16 = 8
In general:
1/x + 1/x 2/x 2/x + 1/x 3/x (and viceversa) 3/x + 1/x 4/x (and viceversa) 6/x + 1/x 7/x (and viceversa)
- Return type:
list[Notation]
- notatedDuration()[source]¶
The duration of the notated figure as a NotatedDuration
A quarter-note inside a triplet would have a notatedDuration of 1
- Return type:
NotatedDuration
- notename(index=0, addExplicitMark=False)[source]¶
Returns the notename corresponding to the given pitch index
If there is a fixed notename for the pitch, that will be returned; otherwise the notename corresponding to the pitch
- Parameters:
index – the index of the pitch (in self.pitches)
addExplicitMark – if True, the notename is suffixed with a ‘!’ sign if the spelling has been fixed
- Return type:
str- Returns:
the notename corresponing to the given pitch
- pitchclassIndex(semitoneDivs=2, index=0)[source]¶
The index of the nearest pitch/microtone
- Parameters:
semitoneDivs – the number of divisions per semitone (1=chromatic, 2=quartertones, …)
index – the index of the pitch within this Notation
- Return type:
int
For example, if divs_per_semitone is 2, then
note
microtone index
4C
0
5C
0
4C+
1
4C#
2
4Db
2
…
…
- quantizedPitches(divs=4)[source]¶
Quantize the pitches of this Notation
- Parameters:
divs – the number of divisions per semitone
- Return type:
list[float]- Returns:
the quantized pitches as midinotes
- removeAttachments(predicate)[source]¶
Remove attachments where predicate is True
- Parameters:
predicate (
Callable[[Attachment],bool]) – a function taking an Attachment, returns True if it should be removed- Return type:
None
- removeAttachmentsByClass(cls)[source]¶
Remove attachments which match the given class
- Return type:
None
- removeSpanner(spanner)[source]¶
Removes the given spanner from this Notation
- Parameters:
spanner (
Spanner|str) – the spanner to remove or the uuid of the spanner to remove- Return type:
None
- resolveHarmonic(removeAttachment=False)[source]¶
Realize an artificial harmonic as a chord with the corresponding noteheads
- Return type:
- Returns:
the modified Notation or self if this Notation is not a harmonic
- resolveNotenames(addFixedAnnotation=False, removeFixedAnnotation=False)[source]¶
Resolve the enharmonic spellings for this Notation
- Parameters:
addFixedAnnotation – if True, enforce the returned spelling by adding a ‘!’ suffix.
removeFixedAnnotation – if True, remove any fixed annotation marks (‘!’) from the notenames
- Return type:
list[str]- Returns:
the notenames of each pitch in this Notation
- setNotehead(notehead, index=None, merge=False)[source]¶
Set a notehead in this notation
- Parameters:
notehead (
Notehead|str) – a Notehead or the notehead shape, as string (one of ‘normal’, ‘hidden’, ‘cross’, ‘harmonic’, ‘rhombus’, ‘square’, etc.). See maelzel.scoring.definitions.noteheadShapes for a complete listindex (
Optional[int]) – the index, corresponding to the pitch at the same index, or None to set all noteheadsmerge – if True and there is already a Notehead set for the given index, the new properties are merged with the properties of the already existing notehead
- Return type:
None
- setPitches(pitches, fixNotenames=False)[source]¶
Set the pitches of this notation, in place
- Parameters:
pitches (
Sequence[float|str]) – a list of midinotes or notenames, or any combinationfixNotenames – if True, fix the notenames for those pitches given as strings. Notenames can also be fixed with a ‘!’ suffix
- Return type:
None
- setProperty(key, value)[source]¶
Set any property of this Notation.
Properties can be used, for example, for any rendering backend to pass directives which are specific to that rendering backend.
- Parameters:
key (
str) – the key to setvalue – the value of the property.
- Return type:
None
- setTieHint(idx, direction='forward')[source]¶
Set a tie hint for a specific pitch in this notation
- Parameters:
idx (
int) – the index of the pitchdirection – one of “forward” or “backward”
- Return type:
None
- splitAtOffset(offset, tie=True, nomerge=False)[source]¶
Split this notations at the given offset
Here we do not check if the resulting parts have a correct quantization or a regular duration
- Parameters:
offset (
Fraction) – the offset to split this notation attie – if True, tie the returned notations
nomerge – if True, mark the split notes as not mergeable between them
- Return type:
- Returns:
a tuple of two notations, the part left to the offset and the part right to the offset.
- Raises:
ValueError – if offset does not split this notation
- splitAtOffsets(offsets, nomerge=False)[source]¶
Splits a Notation at the given offsets
- Parameters:
offsets (
Sequence[Fraction]) – the offsets at which to split n. The offsets must be sorted in ascending order.nomerge – if True, mark the parts as not-mergeable
- Return type:
list[Notation]- Returns:
the parts after splitting
Example:
>>> splitAtOffsets(Notation(F(0.5), duration=F(1))) [Notation(0.5, duration=0.5), Notation(1, duration=0.5)]
- static splitNotationsAtOffsets(notations, offsets, forcecopy=False, nomerge=False)[source]¶
Split notations at the given offsets.
The returned notations do not extend over the offsets
- Parameters:
notations (
list[Notation]) – the notations to split. Their offset must be setoffsets (
Sequence[Fraction]) – the offsets at which to split the notations. The offsets must be sorted in ascending order.forcecopy – if True, all notations are copied even if they are not split
nomerge – if True, mark the split notations as not mergeable
- Return type:
list[Notation]- Returns:
A list of notations that do not extend over the offsets.
- symbolicDuration()[source]¶
The symbolic duration of this Notation.
This method can only be called for quantized notations. This represents the notated figure (1=quarter, 1/2=eighth note, 1/4=16th note, etc)
- Raises:
ValueError – if the notation has not been quantized
- Return type:
Fraction
- tieHints(direction='forward', clear=False)[source]¶
Get any tie hints set
Tie hints indicate which pitches within a chord are actually tied to the next/previous notation. This can be set manually and is set after quantization
- Parameters:
direction – one of “forward” or “backward”
clear – if True, clear the set if applicable
- Return type:
set[int]
- tiedPitches(direction='forward')[source]¶
The list of tied pitches or None if not tied or ties not set
- Parameters:
direction
- Return type:
tuple[float,...] |None
Returns:
- transferSpanner(spanner, other)[source]¶
Move the given spanner to another Notation
- Parameters:
spanner (
Spanner) – the spanner to transferother (
Notation) – the destination notation
- Return type:
bool- Returns:
True if the spanner was actually transferred
This is done when replacing a Notation within a Node but there is a need to keep the spanner
- verticalPosition(index=0)[source]¶
The vertical position of the notated note at given index
The vertical position is the position within the staff in terms of lines/spaces. It is calculated as octave*7 + diatonic_index
Note
Vertical Position
4C
28
4C#
28
4D
29
4Eb
30
…
…
- Parameters:
index – the index of the pitch within this notation
- Return type:
int- Returns:
the vertical position