Midi TEMPO消息如何应用于其他曲目? [英] How does Midi TEMPO message apply to other tracks?

查看:252
本文介绍了Midi TEMPO消息如何应用于其他曲目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我猜出一个相当简单的问题,但我找不到任何地方的明确答案.

A fairly simple question for which I have a guess, but I can't find a definitive answer anywhere.

背景:我有一个多轨道的midi文件,其中第一条轨道带有TEMPO控件.我需要将其他轨道中的ABSOLUTE_TICK计数转换为秒"(与midi文件的开头相差的分数秒).

The background: I have a multi-track midi file with TEMPO controls in the first track. I need to translate the ABSOLUTE_TICK count in other tracks to "Seconds" (fractional seconds offset from the beginning of the midi file).

我有一个公式,可以根据文件的PulsePerQuarterNote(PPQN)将ABSOLUTE_TICK与Seconds关联到速度(每四分音符MS).

I have the formula to relate ABSOLUTE_TICK to Seconds based on the PulsePerQuarterNote (PPQN) for the file to the tempo (MS per quarter note).

问题是:第一个音轨(音轨0)中的TEMPO更改是否适用于所有其他音轨?

The question is: do TEMPO changes in the first track (track 0) apply to all the other tracks?

如果是这样,那么当我解析其他音轨(例如,音轨4,其中包含我感兴趣的NOTE_ON和NOTE_OFF消息)时,我需要保持手指平行指向音轨0中的TEMPO变化.是吗?

If so, then while I'm parsing other tracks (e.g. track 4, which has NOTE_ON and NOTE_OFF messages I am interested in) I will need to keep a finger pointing to the TEMPO changes in track 0 in parallel. Is that right?

谢谢

标记

推荐答案

总之,是的.第一个轨道包含将应用于整个安排的时间信息,因此您将这些消息应用于具有相同绝对时间的每个轨道.由于所有事件的刻度都使用偏移量,因此您需要首先提取速度变化消息,将其转换为绝对时间,然后在阅读其他音轨时,将根据该时间轴应用这些消息.

In short, yes. The first track contains the timing info which will be applied for the entire arrangement, so you apply these messages for each of the tracks with the same absolute time. Since all events use an offset in ticks, you need to first extract the tempo change messages, convert them to absolute time, and then as you are reading in the other tracks you will apply these messages based on that timeline.

来自 MIDI狂热者的技术洗脑中心:

在格式0文件中,速度变化分散在整个一个MTrk中.在格式1中,第一个MTrk应该仅由速度(和时间签名)事件组成,以便可以由某些能够生成速度图"的设备读取.最好不要在此MTrk中放置MIDI事件.在格式2中,每个MTrk应该至少以一个初始速度(和拍号)事件开始.

In a format 0 file, the tempo changes are scattered throughout the one MTrk. In format 1, the very first MTrk should consist of only the tempo (and time signature) events so that it could be read by some device capable of generating a "tempo map". It is best not to place MIDI events in this MTrk. In format 2, each MTrk should begin with at least one initial tempo (and time signature) event.

也就是说,某些音序器确实违反了此规则,将实际的MIDI事件与时序信息一起放在了第一首音轨中,因为标准在这方面不是很具体.您的程序应同时处理这两种情况,因为它很可能会遇到以这种方式格式化的MIDI文件.

That said, some sequencers do break this rule and put actual MIDI events in the first track alongside timing info, since the standard isn't so specific in this regard. Your program should deal with both cases, since it is likely to encounter MIDI files in the wild which are formatted in this way.

这篇关于Midi TEMPO消息如何应用于其他曲目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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