Dec-10-2021, 04:48 PM
I did already some code which prints all midi messages in a dict using mido. This is the result of a test midi-file:
{'type': 'time_signature', 'numerator': 4, 'denominator': 4, 'clocks_per_click': 24, 'notated_32nd_notes_per_beat': 8, 'time': 0}
{'type': 'set_tempo', 'tempo': 500000, 'time': 0}
{'type': 'track_name', 'name': 'Tempo Track', 'time': 0}
{'type': 'track_name', 'name': 'Right', 'time': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 60, 'velocity': 100}
{'type': 'track_name', 'name': 'Left', 'time': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 100}
{'type': 'note_off', 'time': 0.5, 'channel': 0, 'note': 60, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 67, 'velocity': 100}
{'type': 'note_off', 'time': 0.25, 'channel': 0, 'note': 67, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 65, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 100}
{'type': 'note_off', 'time': 0.25, 'channel': 0, 'note': 65, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 64, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 100}
{'type': 'note_off', 'time': 0.5, 'channel': 0, 'note': 64, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 100}
{'type': 'note_off', 'time': 0.25, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 60, 'velocity': 100}
{'type': 'set_tempo', 'tempo': 600000, 'time': 0.25}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 60, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 53, 'velocity': 100}
{'type': 'note_off', 'time': 0.6, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 57, 'velocity': 100}
{'type': 'note_off', 'time': 0.6, 'channel': 1, 'note': 53, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 100}
{'type': 'note_off', 'time': 0.6, 'channel': 1, 'note': 55, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 53, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 1, 'note': 53, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 100}
{'type': 'time_signature', 'numerator': 3, 'denominator': 8, 'clocks_per_click': 24, 'notated_32nd_notes_per_beat': 8, 'time': 0.3}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 57, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 57, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 57, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 65, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 65, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 64, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 64, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 100}
{'type': 'note_on', 'time': 0.3, 'channel': 0, 'note': 60, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 60, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'time_signature', 'numerator': 4, 'denominator': 4, 'clocks_per_click': 24, 'notated_32nd_notes_per_beat': 8, 'time': 0.3}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 64, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 100}
{'type': 'note_off', 'time': 2.4, 'channel': 0, 'note': 64, 'velocity': 0}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 0}
{'type': 'end_of_track', 'time': 0}
I made the file in midieditor and made two tracks:
because the order of messages is in delta times and the note_on/note_off messages do not contain information about the track. In midieditor it can somehow read to which track the note belongs; I want to understand how this works. please give me a explenation
{'type': 'time_signature', 'numerator': 4, 'denominator': 4, 'clocks_per_click': 24, 'notated_32nd_notes_per_beat': 8, 'time': 0}
{'type': 'set_tempo', 'tempo': 500000, 'time': 0}
{'type': 'track_name', 'name': 'Tempo Track', 'time': 0}
{'type': 'track_name', 'name': 'Right', 'time': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 60, 'velocity': 100}
{'type': 'track_name', 'name': 'Left', 'time': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 100}
{'type': 'note_off', 'time': 0.5, 'channel': 0, 'note': 60, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 67, 'velocity': 100}
{'type': 'note_off', 'time': 0.25, 'channel': 0, 'note': 67, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 65, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 100}
{'type': 'note_off', 'time': 0.25, 'channel': 0, 'note': 65, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 64, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 100}
{'type': 'note_off', 'time': 0.5, 'channel': 0, 'note': 64, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 100}
{'type': 'note_off', 'time': 0.25, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 60, 'velocity': 100}
{'type': 'set_tempo', 'tempo': 600000, 'time': 0.25}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 60, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 53, 'velocity': 100}
{'type': 'note_off', 'time': 0.6, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 57, 'velocity': 100}
{'type': 'note_off', 'time': 0.6, 'channel': 1, 'note': 53, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 100}
{'type': 'note_off', 'time': 0.6, 'channel': 1, 'note': 55, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 53, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 1, 'note': 53, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 100}
{'type': 'time_signature', 'numerator': 3, 'denominator': 8, 'clocks_per_click': 24, 'notated_32nd_notes_per_beat': 8, 'time': 0.3}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 57, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 57, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 52, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 57, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 65, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 65, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 64, 'velocity': 100}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 64, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 50, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 100}
{'type': 'note_on', 'time': 0.3, 'channel': 0, 'note': 60, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_off', 'time': 0.3, 'channel': 0, 'note': 60, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 100}
{'type': 'time_signature', 'numerator': 4, 'denominator': 4, 'clocks_per_click': 24, 'notated_32nd_notes_per_beat': 8, 'time': 0.3}
{'type': 'note_on', 'time': 0, 'channel': 0, 'note': 64, 'velocity': 100}
{'type': 'note_off', 'time': 0, 'channel': 0, 'note': 62, 'velocity': 0}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 55, 'velocity': 0}
{'type': 'note_on', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 100}
{'type': 'note_off', 'time': 2.4, 'channel': 0, 'note': 64, 'velocity': 0}
{'type': 'note_off', 'time': 0, 'channel': 1, 'note': 48, 'velocity': 0}
{'type': 'end_of_track', 'time': 0}
I made the file in midieditor and made two tracks:
- Right
- Left
because the order of messages is in delta times and the note_on/note_off messages do not contain information about the track. In midieditor it can somehow read to which track the note belongs; I want to understand how this works. please give me a explenation
