如何解释 MIDI 文件分析的参数值,尤其是 "midi.NoteOnEvent" 的 "data" 字段?
How to interpret values of parameters of MIDI file analysis especially the "data" field of "midi.NoteOnEvent"?
我正在尝试使用工具包 python-midi
为 python
(link to the repo) 分析 MIDI 文件。
基本上,我的问题是关于我刚刚提取的数据的解释。
这是数据:
mididump.py HHOP-Drums.mid
midi.Pattern(format=0, resolution=96, tracks=\
[midi.Track(\
[midi.TrackNameEvent(tick=0, text='HHOP-Drums\x00', data=[72, 72, 79, 80, 45, 68, 114, 117, 109, 115, 0]),
midi.TimeSignatureEvent(tick=0, data=[4, 2, 36, 8]),
midi.NoteOnEvent(tick=0, channel=0, data=[60, 125]),
midi.NoteOnEvent(tick=0, channel=0, data=[71, 110]),
midi.NoteOffEvent(tick=24, channel=0, data=[60, 0]),
midi.NoteOffEvent(tick=0, channel=0, data=[71, 0]),
(...)
midi.NoteOffEvent(tick=12, channel=0, data=[71, 0]),
midi.NoteOffEvent(tick=0, channel=0, data=[72, 0]),
midi.NoteOnEvent(tick=0, channel=0, data=[72, 110]),
midi.NoteOffEvent(tick=24, channel=0, data=[72, 0]),
midi.EndOfTrackEvent(tick=0, data=[])])])
(我省略了大部分 midi。NoteOn/OffEvent 以缩短嵌入在这个问题中的代码。
此 MIDI 音轨的完整分析可在此处获得:http://pastebin.com/5emVhJWb.)
- 我不知道
midi.TrackNameEvent
的 data
字段代表什么。
- 其次,
midi.NoteOn/OffEvent
的 data
字段非常晦涩。根据 python-midi
回购协议的文档:
The NoteOnEvent captures the start of note, like a piano player pushing down on a piano key. The tick is when this event occurred, the pitch is the note value of the key pressed, and the velocity represents how hard the key was pressed.
The NoteOffEvent captures the end of note, just like a piano player removing her finger from a depressed piano key. Once again, the tick is when this event occurred, the pitch is the note that is released, and the velocity has no real world analogy and is usually ignored. NoteOnEvents with a velocity of zero are equivalent to NoteOffEvents.
所以,很容易猜到,对于 midi.NoteOn/OffEvent
data
字段,我们可以这样解释:midi.NoteOnEvent(tick=0, channel=0, data=[note_number, velocity])
.
这是棘手的部分:在分析的循环中分配给 C1 的底鼓。根据this explanation of the MIDI standard C1的音符编号是12。但是,我们可以在分析的输出中看到底鼓的音符编号是71。
为什么会这样?
注:此外,将此分析结果编码回 MIDI 后,底鼓似乎在 Logic(OS X 的音乐软件)中的 C1 处播放。
TrackNameEvent
的 data
字段与 text
相同,只是没有尝试对其进行解码。
音符编号是 MIDI 唯一重要的事情。
你想如何标记它("C1",或"kick drum",或“71”)并不重要,在不同的程序中可能会有所不同。
我正在尝试使用工具包 python-midi
为 python
(link to the repo) 分析 MIDI 文件。
基本上,我的问题是关于我刚刚提取的数据的解释。
这是数据:
mididump.py HHOP-Drums.mid
midi.Pattern(format=0, resolution=96, tracks=\
[midi.Track(\
[midi.TrackNameEvent(tick=0, text='HHOP-Drums\x00', data=[72, 72, 79, 80, 45, 68, 114, 117, 109, 115, 0]),
midi.TimeSignatureEvent(tick=0, data=[4, 2, 36, 8]),
midi.NoteOnEvent(tick=0, channel=0, data=[60, 125]),
midi.NoteOnEvent(tick=0, channel=0, data=[71, 110]),
midi.NoteOffEvent(tick=24, channel=0, data=[60, 0]),
midi.NoteOffEvent(tick=0, channel=0, data=[71, 0]),
(...)
midi.NoteOffEvent(tick=12, channel=0, data=[71, 0]),
midi.NoteOffEvent(tick=0, channel=0, data=[72, 0]),
midi.NoteOnEvent(tick=0, channel=0, data=[72, 110]),
midi.NoteOffEvent(tick=24, channel=0, data=[72, 0]),
midi.EndOfTrackEvent(tick=0, data=[])])])
(我省略了大部分 midi。NoteOn/OffEvent 以缩短嵌入在这个问题中的代码。 此 MIDI 音轨的完整分析可在此处获得:http://pastebin.com/5emVhJWb.)
- 我不知道
midi.TrackNameEvent
的data
字段代表什么。 - 其次,
midi.NoteOn/OffEvent
的data
字段非常晦涩。根据python-midi
回购协议的文档:The NoteOnEvent captures the start of note, like a piano player pushing down on a piano key. The tick is when this event occurred, the pitch is the note value of the key pressed, and the velocity represents how hard the key was pressed.
The NoteOffEvent captures the end of note, just like a piano player removing her finger from a depressed piano key. Once again, the tick is when this event occurred, the pitch is the note that is released, and the velocity has no real world analogy and is usually ignored. NoteOnEvents with a velocity of zero are equivalent to NoteOffEvents.
所以,很容易猜到,对于 midi.NoteOn/OffEvent
data
字段,我们可以这样解释:midi.NoteOnEvent(tick=0, channel=0, data=[note_number, velocity])
.
这是棘手的部分:在分析的循环中分配给 C1 的底鼓。根据this explanation of the MIDI standard C1的音符编号是12。但是,我们可以在分析的输出中看到底鼓的音符编号是71。
为什么会这样?
注:此外,将此分析结果编码回 MIDI 后,底鼓似乎在 Logic(OS X 的音乐软件)中的 C1 处播放。
TrackNameEvent
的data
字段与text
相同,只是没有尝试对其进行解码。音符编号是 MIDI 唯一重要的事情。 你想如何标记它("C1",或"kick drum",或“71”)并不重要,在不同的程序中可能会有所不同。