How are NoteEvents used?
I've been looking through the code and noticing that chords are built of notes and the notes in turn can have multiple note events attached to them. These note events can alter the pitch, start time and duration of their underlying note.
It seems to me that these events are duplicating the work of the note object. Are they used for minor adjustments, such as adding trills or a swing rhythm? Are the note events actually what plays on playback, with the parent Note serving more as a container to hold the NoteEvents?
Comments
The way I would put it is, the Note is the abstract object representing what you see on the page, the NoteEvent is the specific sound or sounds associated with that note. It's not that the NoteEvent "alters" the note, it just represents something different. A Note can multiple NoteEvents - trills, etc - or it might have none (eg, if turn off the Play property). During playback, NoteEvents are generated as necessary, and those in turn generate the actual MIDI messages.
In reply to The way I would put it is,… by Marc Sabatella
Thanks. The way the piano roll editor is currently implemented, it displays individual NoteEvents rather than the Notes themselves. When the staff is parsed, a PianoItem is created to track for every NoteEvent and the NoteEvent ontime, pitch and len are used to alter the base Note value. When the user tries to change the note length using the spinner control, it is the NoteEvent rather than the Note which is updated.
Given the way you describe NoteEvents above, this seems to me like incorrect behavior. If the NoteEvent data is generated just for the purpose of playback and can be discarded and rebuilt at any time, it seems to me that the piano roll editor should ignore any NoteEvents and just display the Notes. Am I understanding this correctly?
In reply to Thanks. The way the piano… by blackears
I am going out of my area of expertise a bit here, but I believe it would be more accurate for me to say "normal" note events are generated on the fly, but ones modified in the pianoroll are persistent. This is controlled by the playEventType field in the Chord (see chord.h). Note there is a distinction between "play events" and "note events" that I'm not sure is used consistently in the naming or descriptions.