-
Notifications
You must be signed in to change notification settings - Fork 405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Export Unpitched to MIDI #1315
Export Unpitched to MIDI #1315
Conversation
@@ -1776,6 +1776,7 @@ class Unpitched(NotRest): | |||
|
|||
def __init__(self, displayName=None, **keywords): | |||
super().__init__(**keywords) | |||
self._chordAttached: t.Optional['music21.percussion.PercussionChord'] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was already being set in ChordBase._add_core_or_init()
, but without being initialized anywhere.
Super wonderful! Thank you! Is there a test for if the instrument is stored directly on the unpitched element? Can be added later. |
# Change the stored instrument: affects that note only | ||
m.notes.first().storedInstrument = instrument.Agogo() | ||
|
||
trks = streamHierarchyToMidiTracks(m) | ||
mixed_trk = trks[1] | ||
|
||
self.assertTrue({ev.channel for ev in mixed_trk.events}, {10}) | ||
note_ons = [ | ||
ev for ev in mixed_trk.events if ev.type is midiModule.ChannelVoiceMessages.NOTE_ON] | ||
self.assertEqual(len(note_ons), 3) | ||
self.assertEqual([ev.pitch for ev in note_ons], [67, 60, 60]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, if I'm following, then that's tested here: put Agogo on the first unpitched note in the stream and get midi note 67 on that one only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, missed it -- thanks!
Fixes #238