English 中文(简体)
Converting MIDI ticks to actual playback seconds
原标题:
  • 时间:2010-01-10 19:43:32
  •  标签:
  • midi

I want to know how to convert MIDI ticks to actual playback seconds.

For example, if the MIDI PPQ (Pulses per quarter note) is 1120, how would I convert it into real world playback seconds?

最佳回答

The formula is 60000 / (BPM * PPQ) (milliseconds).

Where BPM is the tempo of the track (Beats Per Minute).

(i.e. a 120 BPM track would have a MIDI time of (60000 / (120 * 192)) or 2.604 ms for 1 tick.

If you don t know the BPM then you ll have to determine that first. MIDI times are entirely dependent on the track tempo.

问题回答

You need two pieces of information:

  • PPQ (pulses per quarter note), which is defined in the header of a midi file, once.
  • Tempo (in microseconds per quarter note), which is defined by "Set Tempo" meta events and can change during the musical piece.

Ticks can be converted to playback seconds as follows:

ticks_per_quarter = <PPQ from the header>
µs_per_quarter = <Tempo in latest Set Tempo event>
µs_per_tick = µs_per_quarter / ticks_per_quarter
seconds_per_tick = µs_per_tick / 1.000.000
seconds = ticks * seconds_per_tick

Note that PPQ is also called "division" or "ticks per quarter note" in the document linked above.

Note that Tempo is commonly represented in BPM (a frequency) but raw MIDI represents it in µs per quarter (a period).





相关问题
Converting MIDI ticks to actual playback seconds

I want to know how to convert MIDI ticks to actual playback seconds. For example, if the MIDI PPQ (Pulses per quarter note) is 1120, how would I convert it into real world playback seconds?

play midi files in flash

is there a way to play midi files in flash? using actionscript 3?

Getting signals from a MIDI port in C#

I bought a MIDI keyboard for my birthday. I found a program (MidiPiano) that gets signals from the MIDI input and translates it into music, but I d rather like to write one myself. Where can I find ...

C++: Get data from MIDI message (DWORD)

I ve written a simple MIDI console application in C++. Here s the whole thing: #include <windows.h> #include <iostream> #include <math.h> using namespace std; void CALLBACK ...

wav to midi conversion

Are there any Open source APIs available for wav to midi conversion? You find many open source software, but I couldn t find APIs. Is there any way I can find them? Also are there any Open source APIs ...

iPhone midi implementation

i want to synchronize my app to an external midi clock. does anyone know of any code base to do this on the iphone? i dont want to generate midi events i just want to respond to timing information

热门标签