简体   繁体   English

XG MIDI 信息

[英]XG MIDI messages

I am working on a Java program that uses javax.sound.midi for reading MIDI files.我正在开发一个使用 javax.sound.midi 读取 MIDI 文件的 Java 程序。

I have come across a MIDI file that is encoded in XG.我遇到了一个用 XG 编码的 MIDI 文件。

When I play it on my Yamaha keyboard the drums sound fine.当我在 Yamaha 键盘上演奏时,鼓声听起来不错。 But in Java I do not know how to detect a track is drums if the MIDI is XG, or how to find out the MIDI is XG for that sake.但是在 Java 中,如果 MIDI 是 XG,我不知道如何检测曲目是否是鼓,或者为此如何找出 MIDI 是 XG。

The way of doing it by detecting if channel is equal to 9 in Note ON messages, does not seem to detect all XG drum notes.通过在 Note ON 消息中检测通道是否等于 9 来执行此操作的方法似乎并未检测到所有 XG 鼓音符。

Anyone knows a (hopefully simple) way to detect XG drum notes?任何人都知道一种(希望是简单的)检测 XG 鼓音符的方法?

The general answer is there is no "simple" way of detecting that a midi file uses XG drums notes.一般的答案是没有“简单”的方法来检测 MIDI 文件是否使用 XG 鼓音符。

If you assume drums are on channel 10 [1-16], which is not mandatory with a XG synth, the presence of drums notes which are out of the GM drum map [pitch 35-81] might give you a hint.如果您假设鼓在通道 10 [1-16] 上,这对于 XG 合成器来说不是必需的,那么 GM 鼓映射 [pitch 35-81] 之外的鼓音符的存在可能会给您一个提示。 But it could also be a GM2 file!但它也可能是一个 GM2 文件! And some drums styles may not use these non-GM notes, even if it's really a XG file.并且某些鼓风格可能不会使用这些非 GM 音符,即使它确实是一个 XG 文件。

A better way is probably to search for a XG specific SysEx message, such as XG SYSTEM ON ( F0,43,10,4C,00,00,7E,00,F7 ), which is necessary to enable the 'XG Mode' of a XG synthesizer.更好的方法可能是搜索特定于 XG 的 SysEx 消息,例如 XG SYSTEM ON ( F0,43,10,4C,00,00,7E,00,F7 ),这是启用“XG 模式”所必需的XG 合成器。

Also, if your XG files always come from the same source, you could check if the Midi file contains some Meta messages such as Text, Copyright notice, Instrument name, Track name, which might indicate it's a XG file.此外,如果您的 XG 文件始终来自同一来源,您可以检查 Midi 文件是否包含一些元消息,例如文本、版权声明、乐器名称、曲目名称,这可能表明它是 XG 文件。

XG allows drum sets on any channel. XG 允许在任何通道上设置鼓组。

You need to check for "Bank Select" and "Program Change" messages.您需要检查“Bank Select”和“Program Change”信息。

Here are your drums on channels 9, 10, 11:这是您在第 9、10、11 频道的鼓:

offset   tick  message
...
[  545]   842: b8 00 7f -- Bank Select MSB
[  549]   844: b8 20 00 -- Bank Select LSB
[  553]   846: c8 10 -- Program Change (Rock Drum Kit)
...
[  602]   872: b9 00 7f -- Bank Select MSB
[  606]   874: b9 20 00 -- Bank Select LSB
[  610]   876: c9 00 -- Program Change (Standard Drum Kit)
...
[  648]   900: ba 00 7f -- Bank Select MSB
[  652]   902: ba 20 00 -- Bank Select LSB
[  656]   904: ca 19 -- Program Change (Analog Drum Kit)

The above listing was made using https://github.com/jazz-soft/test-midi-files上面的清单是使用https://github.com/jazz-soft/test-midi-files 制作的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM