How to interpret values of parameters of MIDI file analysis especially the “data” field of “midi.NoteOnEvent”?

為{幸葍}努か 提交于 2019-12-12 11:34:11

问题


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

Basically, my question is about the interpretation of the data I just extracted.

Here is the data:

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=[])])])

(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. 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:

    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.

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

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.

Why is it so?


Note: What is more, after encoding the results of this analysis back to MIDI, the kickdrum seems to play at the C1 in Logic (a musical software for OS X).


回答1:


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

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



来源:https://stackoverflow.com/questions/29718532/how-to-interpret-values-of-parameters-of-midi-file-analysis-especially-the-data

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!