Select 使用 Python Mido 库的 GM MIDI Level 2 乐器
Select GM MIDI Level 2 instruments using the Python Mido library
我正在使用 Python Mido
用于创建 MIDI 文件的库。我想出了改变
乐器,您将 program_change
消息添加到轨道
给定频道:
from mido import Message, MidiFile, MidiTrack
track = MidiTrack()
...
track.append(Message('program_change', program = 36,
time = 1234, channel = 0)
这有效,但我只能访问 GM MIDI Level 1 乐器。我
想要访问
GM MIDI Level 2 乐器也是。
请用代码告诉我如何做到这一点。所有 MIDI 文档
我通过谷歌搜索发现非常混乱。
3.2 Program Change Message
[…]
Sets the timbre for the specified Channel.
When the Channel is a Melody Channel, the timbre is selected from the Bank specified by Bank Select (using Bank Select 79H/xxH, with Bank 79H/00H corresponding to the GM1 sound set). […]
3.3.1 Bank Select (cc#0/32)
Bank Select selects the desired Bank for the specified Channel. The first byte listed is the MSB, transmitted on cc#0. The second byte listed is the LSB, transmitted on cc#32. Banks are listed in the GM2 Sound Set table (Appendix A). Bank Select 79H/00H corresponds to the GM1 Sound Set.[…]
The Bank Select message shall not affect any change in sound until a subsequent Program Change message is received.
因此,要访问其他乐器,您必须在发送程序更改消息之前select 不同的库。
例如,select "Bubble":
track.append(Message('control_change', control = 0, value = 0x79, channel = 0, time = 1233))
track.append(Message('control_change', control = 32, value = 0x05, channel = 0, time = 1233))
track.append(Message('program_change', program = 0x7a, channel = 0, time = 1234))
我正在使用 Python Mido
用于创建 MIDI 文件的库。我想出了改变
乐器,您将 program_change
消息添加到轨道
给定频道:
from mido import Message, MidiFile, MidiTrack
track = MidiTrack()
...
track.append(Message('program_change', program = 36,
time = 1234, channel = 0)
这有效,但我只能访问 GM MIDI Level 1 乐器。我 想要访问 GM MIDI Level 2 乐器也是。
请用代码告诉我如何做到这一点。所有 MIDI 文档 我通过谷歌搜索发现非常混乱。
3.2 Program Change Message
[…]
Sets the timbre for the specified Channel.When the Channel is a Melody Channel, the timbre is selected from the Bank specified by Bank Select (using Bank Select 79H/xxH, with Bank 79H/00H corresponding to the GM1 sound set). […]
3.3.1 Bank Select (cc#0/32)
Bank Select selects the desired Bank for the specified Channel. The first byte listed is the MSB, transmitted on cc#0. The second byte listed is the LSB, transmitted on cc#32. Banks are listed in the GM2 Sound Set table (Appendix A). Bank Select 79H/00H corresponds to the GM1 Sound Set.[…]
The Bank Select message shall not affect any change in sound until a subsequent Program Change message is received.
因此,要访问其他乐器,您必须在发送程序更改消息之前select 不同的库。 例如,select "Bubble":
track.append(Message('control_change', control = 0, value = 0x79, channel = 0, time = 1233))
track.append(Message('control_change', control = 32, value = 0x05, channel = 0, time = 1233))
track.append(Message('program_change', program = 0x7a, channel = 0, time = 1234))