Mateusz Piotrowski
Mateusz Piotrowski

Reputation: 9147

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

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

Upvotes: 4

Views: 1484

Answers (1)

CL.
CL.

Reputation: 180210

  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.

Upvotes: 1

Related Questions