如何解释MIDI文件分析的参数值,特别是“数据"参数.字段"midi.NoteOnEvent"? [英] How to interpret values of parameters of MIDI file analysis especially the "data" field of "midi.NoteOnEvent"?

查看:370
本文介绍了如何解释MIDI文件分析的参数值,特别是“数据"参数.字段"midi.NoteOnEvent"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用python的工具包python-midi分析MIDI文件(链接到存储库).

I am trying to analyse MIDI files using a toolkit python-midi for python (link to the repo).

基本上,我的问题是关于我刚刚提取的数据的解释.

以下是数据:

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 .)

(I omitted most of the midi.NoteOn/OffEvent to shorten the code embeded in this question. Full analysis of this MIDI track is available here: http://pastebin.com/5emVhJWb.)

  1. 我不知道midi.TrackNameEventdata字段代表什么.
  2. 第二,midi.NoteOn/OffEventdata字段非常模糊.根据python-midi回购的文档:
  1. I don't know what does a data field of midi.TrackNameEvent stands for.
  2. Secondly, a data field of midi.NoteOn/OffEvent is quite obscure. According to the documentation of the python-midi repo:

NoteOnEvent捕获音符的开始,就像钢琴演奏者按下钢琴键一样.滴答声是发生此事件的时间,音高是按下键的音符值,而力度表示按下键的力度.

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.

NoteOffEvent捕获音符的结尾,就像钢琴演奏者从按下的钢琴键上移开手指一样.再说一次,滴答声是发生此事件的时间,音调是释放的音符,速度没有现实世界的类比,通常被忽略.速度为零的NoteOnEvents等同于NoteOffEvents.

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]).

So, it is easy to guess, that in case of the midi.NoteOn/OffEvent data field, we can interpret it like this: midi.NoteOnEvent(tick=0, channel=0, data=[note_number, velocity]).

这是棘手的部分:在分析的循环中分配给C1的脚鼓.按照此MIDI标准的解释 C1的音符编号为12.但是,我们可以看到在分析的输出中,反冲鼓的音符号为71.

Here's the tricky part: The kick drum assigned to C1 in the analysed loop. Accoding to this explanation of the MIDI standard C1's note number is 12. However, we can see in the output of the analysis, that the note number of the kick drum is 71.

为什么会这样?

注意:此外,在将分析结果编码回MIDI之后,踢鼓似乎在Logic(OS X的音乐软件)的C1上播放.

推荐答案

  1. TrackNameEventdata字段与text相同,只是不尝试对其进行解码.

  1. The data field of the TrackNameEvent is the same as the text, only without trying to decode it.

对于MIDI而言,音符编号是唯一重要的事情. 标记的方式("C1"或踢鼓"或"71")并不重要,在不同的程序中可能会有所不同.

The note number is is the only thing that matters for MIDI. How you want do label it ("C1", or "kick drum", or "71") is not important, and might be different in different programs.

这篇关于如何解释MIDI文件分析的参数值,特别是“数据"参数.字段"midi.NoteOnEvent"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆