Note¶
- class paeonia.Note(pitches: 'tuple[Pitch, ...]' = (), duration: 'Fraction' = Fraction(1, 4), velocity: 'float' = 0.75, tie_in: 'bool' = False, tie_out: 'bool' = False)[source]¶
Bases:
object- Parameters:
pitches (tuple[Pitch, ...])
duration (Fraction)
velocity (float)
tie_in (bool)
tie_out (bool)
- stretch(factor, *, quantize=True)[source]¶
Return a copy whose duration is multiplied by
factor.The factor is converted to an exact
fractions.Fractionbefore multiplication. Decimal float literals therefore retain their written value: for example,0.5is treated asFraction(1, 2). Pitches, velocity, and tie metadata are unchanged. By default, the result is quantized to the nearest duration that the current LilyPond renderer can express as one token: a power-of-two value from a maxima through a 128th note, with zero, one, or two dots. Equidistant values choose the shorter duration, and values outside the supported range clamp to its nearest endpoint.- Parameters:
factor (int | float | Fraction) – Finite, strictly positive duration multiplier.
quantize (bool, default=True) – Snap the result to the nearest directly notatable duration. When false, retain the exact multiplied duration even if notation rendering cannot express it as one token.
- Returns:
A new note with the stretched duration.
- Return type:
- Raises:
TypeError – If
factoris not an integer, float, or fraction, or ifquantizeis not Boolean.ValueError – If
factoris non-finite or not strictly positive.