加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

如何解释MIDI文件分析参数的值,特别是“midi.NoteOnEvent”的“

发布时间:2020-12-20 13:48:40 所属栏目:Python 来源:网络整理
导读:我正在尝试使用 python( link to the repo)的工具包python-midi来分析MIDI文件. 基本上,我的问题是关于我刚提取的数据的解释. 这是数据: mididump.py HHOP-Drums.mid midi.Pattern(format=0,resolution=96,tracks=[midi.Track( [midi.TrackNameEvent(tick
我正在尝试使用 python( link to the repo)的工具包python-midi来分析MIDI文件.

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

这是数据:

mididump.py HHOP-Drums.mid 
midi.Pattern(format=0,resolution=96,tracks=
[midi.Track(
  [midi.TrackNameEvent(tick=0,text='HHOP-Drumsx00',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]),data=[71,110]),midi.NoteOffEvent(tick=24,midi.NoteOffEvent(tick=0,(...)
   midi.NoteOffEvent(tick=12,midi.EndOfTrackEvent(tick=0,data=[])])])

(我省略了midi.NoteOn / OffEvent的大部分内容,以缩短此问题中嵌入的代码.
有关此MIDI轨道的完整分析,请访问:http://pastebin.com/5emVhJWb.)

>我不知道midi.TrackNameEvent的数据字段代表什么.
>其次,midi.NoteOn / OffEvent的数据字段非常模糊.根据python-midi repo的文档:

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数据字段的情况下,我们可以这样解释:midi.NoteOnEvent(tick = 0,channel = 0,data = [note_number,velocity]).

这是一个棘手的部分:在分析循环中分配给C1的底鼓.编号为this explanation of the MIDI standard C1的音符编号为12.但是,我们可以在分析的输出中看到,底鼓的音符编号为71.

为什么会这样?

注意:更重要的是,在将此分析的结果编码回MIDI之后,这个替代品似乎在Logic中的C1(OS X的音乐软件)中播放.

解决方法

> TrackNameEvent的数据字段与文本相同,只是不尝试解码它. >音符编号是唯一对MIDI有用的东西. 如何标记它(“C1”,或“踢鼓”或“71”)并不重要,并且可能在不同的程序中有所不同.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读