如何使用pygame midi发送NRPN消息

2024-09-30 03:22:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在编写一个程序,它将从只能发送cc的设备读取传入的cc消息,并将其作为nrpn消息发送到另一个设备。我知道如何从pygame发送cc消息,但我无法集中精力在如何发送nrpn上。我查看了Vriareon代码,我看不出其中任何地方甚至可以访问midi。有人能举个例子说明这是怎么做到的吗?

谢谢你!


Tags: 代码程序消息地方pygame例子midicc
1条回答
网友
1楼 · 发布于 2024-09-30 03:22:19

NRPN消息是CC消息。在

然而,NRPN数与CC数不同。MIDI specification上写着:

Controller number 6 (Data Entry), in conjunction with Controller numbers 96 (Data Increment), 97 (Data Decrement), 98 (Non-Registered Parameter Number LSB), 99 (Non-Registered Parameter Number MSB), 100 (Registered Parameter Number LSB), and 101 (Registered Parameter Number MSB), extend the number of controllers available via MIDI. Parameter data is transferred by first selecting the parameter number to be edited using controllers 98 and 99 or 100 and 101, and then adjusting the data value for that parameter using controller number 6, 96, or 97.

要更改类似卷(7)的控制器,请发送一条消息:

B0 07 xx

要更改NRPN,请先选择NRPN:

^{pr2}$

然后更改当前选择的NRPN数据项:

B0 06 mm
B0 26 ll  (optional, for 14-bit values)

因此,将NRPN 0:1设置为值42可以通过以下方式完成:

self.midi_out.write_short(0xb0, 0x63, 0)
self.midi_out.write_short(0xb0, 0x62, 1)
self.midi_out.write_short(0xb0, 0x06, 42)

相关问题 更多 >

    热门问题