How to get the exact time of a MIDI event

I am trying to read a MIDI file, and I want to determine the exact time of a NoteOn event from it in C #.
I tried to use absolute time, but the result was something like 256632.
What is this number? This is a line of my code that returns the time:

(note as NoteOnEvent).AbsoluteTime
+4
source share
2 answers

A MIDI file contains only incremental times. Included as a variable length between 1 and 4 bytes before each MIDI event. The library you use is useful for providing you with the AbsoluteTime property. It is simply calculated by summing incremental times for each event.

- "-". - , MIDI. NAudio MidiFile.DeltaTicksPerQuarterNote. , , AbsoluteTime, , .

, , , . , . , TempoEvent NAudio. MicrosecondsPerQuarterNote , . , .

+10

-

, MIDI, . delta-time.

, (VLQ). , , VLQ 32 (4 ). , ( ), , , , MIDI , int. long AbsoluteTime NAudio - .

AbsoluteTime - .

, - , MIDI. :

  • Ticks Per Quarter
  • SMPTE Time Division

. , 96, - 48 . , NAudio MidiFile.DeltaTicksPerQuarterNote

, , SMPTE MIDI Time Code. .

""

, "" (, , ). Hans Passant CL, MIDI MIDi.

, . , DryWetMIDI :

MidiFile midiFile = MidiFile.Read("Some MIDI file.mid");
TempoMap tempoMap = midiFile.GetTempoMap();

MetricTimeSpan timeOf10thEvent = midiFile.GetTimedEvents()
                                         .Skip(9)
                                         .First()
                                         .TimeAs<MetricTimeSpan>(tempoMap);

, ( BarBeatTimeSpan) ( MusicalTimeSpan).

. , , MIDI , GetTempoMap MidiFile.

0

Source: https://habr.com/ru/post/1536505/


All Articles