MIDI:将 BPM 转换为 FPS 增量时间?

发布于 2024-09-08 15:58:44 字数 341 浏览 1 评论 0原文

给定速度为 192 的 BPM(每分钟节拍)MIDI 增量时间(最左边位关闭):

0x00C0

我想将其转换为 FPS/TPM(每秒帧数/每分钟滴答数)增量时间(最左边位打开),但它如果你明白我的意思的话,应该是相同的(或最准确的)速度值。

有关 MIDI 增量时间的更多信息,请查看标题块下的 Midi 文件格式 ->时间划分。

我正在寻找一个可以在这两种增量时间类型之间进行转换的公式。

Given a BPM (beats per minute) MIDI delta time (leftmost bit off) with speed of 192:

0x00C0

I want to convert it to a FPS/TPM (frames per second / ticks per minute) delta time (leftmost bit on), but it should be the same (or the most accurate) speed value if you know what I mean.

For more info about MIDI Delta Time please take a look at Midi File Format under Header Chunk -> Time Division.

I am looking for a formula that will convert between these two deltatime types.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

勿忘初心 2024-09-15 15:58:44

如果你说 0x00C0 是时分字段,那么你指的不是每分钟 192 节拍,而是每节拍 192 节拍,这是完全不同的兽。 BPM 通过“Set Tempo”事件间接指定,以每节拍的微秒为单位(假设以普遍存在的 120 BPM 开始)。这种格式的时间划分的棘手之处在于,滴答声的长度会根据歌曲的节奏变化而增加和缩短。

假设您要转换的时分使用 F 作为每秒帧数(24、25、29.97 或 30),使用 G 作为每帧的刻度数 (< em>注意:这不是每分钟的滴答数!)。此外,我们假设当前节奏(每节拍微秒)为 p。然后,将给定持续时间(以刻度为单位)转换为刻度(单位分析确实很有帮助!)的公式是:

y = x 刻度 * (1/192) 节拍/刻度 * p µsec/节拍 * (1/106 ) 秒/微秒 * F 帧/秒 * G 刻度/帧
   = ((x * p * F * G)/(192*106)) 刻度

If you're talking about 0x00C0 being the time division field, what you're referring to is not 192 beats per minute, but rather 192 ticks per beat, quite a different beast. BPM is specified indirectly via "Set Tempo" events, given in microseconds per beat (with the lamentably ubiquitous 120 BPM being assumed to begin with). The trickiness of time division with this format is that the length of a tick will grow and shrink depending on the tempo changes in the song.

Let's say the time division you want to convert to has F as the frames per second (24, 25, 29.97, or 30) and G as the ticks per frame (note: it's not ticks per minute!). Further, let's assume that the current tempo in microseconds per beat is p. Then the formula to convert a given duration in ticksold to ticksnew (the unit analysis really helps!) is:

y = x ticksold * (1/192) beat/ticksold * p μsec/beat * (1/106) sec/μsec * F frames/sec * G ticksnew/frame
   = ((x * p * F * G)/(192*106)) ticksnew

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文