Mido midi - 如果我在键盘上弹奏,发现的 Note_On 事件是在钢琴卷帘中绘制音符的两倍......?
Mido midi - finds twice as many Note_On events if I play on my keyboard, as opposed to drawing notes in the piano roll...?
我编写了一个程序来解析 midi 文件并找到所有 Note_On 事件。
我进入我的 DAW 钢琴卷并 在 D4、D5、F4
中绘制
我的程序正确找到了 Note_One 个事件并正确识别了它们。
然后我用我的 midi 键盘演奏完全相同的音符,并保存 midi 文件。
我的程序找到,D4,D4,D5,D5,F4,F4
即它使音符加倍!为什么我得到不同的结果?两个 MIDI 文件在 DAW 中看起来一样:它们都有三个音符。
这是两个 MIDI 文件:
https://drive.google.com/drive/folders/1CUgTJNH-jD5rPJEmT0aSwRp4PhaatxYq?usp=sharing
这是我从文件中读取 Midi 数据的代码:
for i, track in enumerate(Ians_midi.tracks):
for msg in track:
if msg.type == 'note_on': ...
MIDI 规范说:
MIDI provides two roughly equivalent means of turning off a note (voice). A note may be turned off
either by sending a Note-Off message for the same note number and channel, or by sending a Note-On
message for that note and channel with a velocity value of zero. The advantage to using "Note-On at
zero velocity" is that it can avoid sending additional status bytes when Running Status is employed.
Due to this efficiency, sending Note-On messages with velocity values of zero is the most commonly used
method. However, some keyboard instruments implement release velocity where a Note-Off code (8nH)
accompanied by a "velocity off" byte is used. A receiver must be capable of recognizing either method of
turning off a note, and should treat them identically.
所以当你收到 note_on
消息时,你还必须检查它的 velocity
。
我编写了一个程序来解析 midi 文件并找到所有 Note_On 事件。
我进入我的 DAW 钢琴卷并 在 D4、D5、F4
中绘制我的程序正确找到了 Note_One 个事件并正确识别了它们。
然后我用我的 midi 键盘演奏完全相同的音符,并保存 midi 文件。
我的程序找到,D4,D4,D5,D5,F4,F4
即它使音符加倍!为什么我得到不同的结果?两个 MIDI 文件在 DAW 中看起来一样:它们都有三个音符。
这是两个 MIDI 文件:
https://drive.google.com/drive/folders/1CUgTJNH-jD5rPJEmT0aSwRp4PhaatxYq?usp=sharing
这是我从文件中读取 Midi 数据的代码:
for i, track in enumerate(Ians_midi.tracks):
for msg in track:
if msg.type == 'note_on': ...
MIDI 规范说:
MIDI provides two roughly equivalent means of turning off a note (voice). A note may be turned off either by sending a Note-Off message for the same note number and channel, or by sending a Note-On message for that note and channel with a velocity value of zero. The advantage to using "Note-On at zero velocity" is that it can avoid sending additional status bytes when Running Status is employed.
Due to this efficiency, sending Note-On messages with velocity values of zero is the most commonly used method. However, some keyboard instruments implement release velocity where a Note-Off code (8nH) accompanied by a "velocity off" byte is used. A receiver must be capable of recognizing either method of turning off a note, and should treat them identically.
所以当你收到 note_on
消息时,你还必须检查它的 velocity
。