Gracenote

maelzel.core.event.Gracenote(pitch, slash=True, stemless=False, offset=None, **kws)[source]

Create a gracenote (a note or chord)

The resulting gracenote will be a Note or a Chord, depending on pitch.

Note

A gracenote is just a regular note or chord with a duration of 0. This function is here for visibility and to allow to customize the slash attribute

Parameters:
  • pitch (Union[int, float, str, Sequence[Union[int, float, str]]]) – a single pitch (as midinote, notename, etc), a list of pitches or string representing one or more pitches

  • offset (Union[float, Rational, Fraction, None]) – the offset of this gracenote. Normally a gracenote should not have an explicit offset

  • slash – if True, the gracenote will be marked as slashed

  • stemless – if True, hide the stem of this gracenote

Return type:

Note | Chord

Returns:

a Note if one pitch is given, a Chord if a list of pitches are passed instead. A gracenote is basically a note/chord with 0 duration

Example

>>> grace = Gracenote('4F')
>>> grace2 = Note('4F', dur=0)
>>> grace == grace2
True
>>> gracechord = Gracenote('4F 4A')
>>> gracechord2 = Chord('4F 4A', dur=0)
>>> gracechord == gracechord2
True