Grace¶
- maelzel.core.event.Grace(pitch, slash=False, stemless=False, offset=None, value=None, hidden=False, parenthesis=False, **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 attributes specific to a gracenote
- 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 pitchesoffset (
Union[int,float,Fraction,None]) – the offset of this gracenote. Normally a gracenote should not have an explicit offsetslash – if True, the gracenote will be marked as slashed
stemless – if True, hide the stem of this gracenote
value (
Optional[Fraction]) – the rhythmic value to use (1/2=eighth note, 1/4=sixteenth note, etc.)
- Return type:
- 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 = Grace('4F') >>> grace2 = Note('4F', dur=0) >>> grace == grace2 True >>> gracechord = Grace('4F 4A') >>> gracechord2 = Chord('4F 4A', dur=0) >>> gracechord == gracechord2 True