Midi时间戳(以秒为单位) [英] Midi timestamp in seconds

查看:896
本文介绍了Midi时间戳(以秒为单位)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以秒为单位的时间戳公式是什么? 刻度线实际上是一个时间戳记

What is the formula for timestamp in second? The tick is actually a timestamp

来自Midi DumpSequence:

From Midi DumpSequence:

tick 0: Set Tempo: 88.0 bpm
tick 0: Time Signature: 4/4,

MIDI clocks per metronome tick: 24,
1/32 per 24 MIDI clocks: 8

tick 0: Sequence/Track Name:         
tick 0: Sysex message: F0 7E 7F 09 01 F7
tick 480: Sysex message: F0 43 10 4C 00 00 7E 00 F7
tick 600: Sysex message: F0 43 10 4C 02 01 40 03 00 F7
tick 602: Sysex message: F0 43 10 4C 02 01 5A 01 F7
tick 604: ch01
tick 606: ch01
tick 608: ch01
tick 613: ch01
tick 615: ch01
tick 617: ch01
tick 619: ch01
tick 621: ch01
tick 623: ch01
tick 625: ch02
tick 627: ch02
tick 629: ch02
tick 634: ch02
tick 636: ch02
tick 638: ch02
tick 640: ch02
tick 642: ch02
tick 644: ch02
tick 1920: Time Signature: 4/4, MIDI clocks per metronome tick: 24, 1/32 per 24 MIDI clocks: 8
tick 1920: ch01+B2
tick 2784: ch01-B2
tick 2880: ch01+G2
tick 3744: ch01-G2
tick 3840: ch01+A2
tick 4704: ch01-A2
tick 4800: ch01+D2

推荐答案

要计算MIDI事件的度量时间,您需要知道两个值:

To calculate metric time of a MIDI event you need to know two values:

  • 每个qurter音符的拍数(节拍)
  • 每拍微秒

第一个值包含在MIDI文件的标头块(MThd)的时分参数中.您的转储中不包含此信息.

The first value is contained in the time division parameter of the header chunk (MThd) of a MIDI file. Your dump doesn't contain this information.

第二个值可以从 Set Tempo事件中检索.您的转储从此事件开始,但是我应该注意,MIDI文件中的速度是以每节拍微秒而不是每分钟节拍(BPM)表示的.在某些情况下,BPM可能不准确,因为它被计算为60,000,000/microseconds_per_beat.

The second value can be retrieved from a Set Tempo event. Your dump starts with this event, but I should to notice that tempo is presented in a MIDI file as microseconds per beat rather than beats per minute (BPM). In some cases BPM can be inaccurate since it is calculated as 60,000,000 / microseconds_per_beat.

使用这两个值,我们可以计算出一滴答的持续时间:

Using these two values we can calculate duration of one tick:

tick_duration = microseconds_per_beat / ticks_per_beat

或者如果您将节奏设置为BPM

or if you have tempo as BPM

tick_duration = 60,000,000 / (beats_per_minute * ticks_per_beat)

因此,对于任何时间戳记,其度量表示均可通过以下公式计算:

Thus, for any arbitrary timestamp its metric representation can be calculated by the formula:

microseconds = ticks * tick_duration

这篇关于Midi时间戳(以秒为单位)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆