asEvent¶
- maelzel.core.event.asEvent(obj, **kws)[source]¶
Convert obj to a Note or Chord, depending on the input itself
Input
Output
int, float (midinote)
Note
list (of notes)
Chord
notename as string (“C4”)
Note
str with notenames (“C4 E4”)
Chord
- Parameters:
obj – the object to convert
kws – any keyword passed to the constructor (Note, Chord)
- Return type:
- Returns:
the resulting object, either a Note or a Chord
Example
>>> from maelzel.core import * >>> asEvent("4C") # a Note 4C >>> asEvent("4C E4") # a Chord ‹4C 4E› >>> asEvent("4C:1/3:accent") 4C:0.333♩:symbols=[Articulation(kind=accent)] # Internally this note has a duration of 1/3 >>> asEvent("4C,4E:0.5:mf") ‹4C 4E 0.5♩ mf›