[英]Invalid MIDI message Data when I'm trying to send Control Change Messages
I'm using pygame.midi library to send MIDI Messages (Control Change messages, not notes). 我正在使用pygame.midi库发送MIDI消息(控制更改消息,而不是音符)。 The idea is to send from the output (from this python program) to the input of another program. 这个想法是从输出(从这个python程序)发送到另一个程序的输入。
>>> import time
>>> import pygame.midi as midi
>>> midiout = midi.Output(3)
>>> midi.init()
>>> midiout = midi.Output(3)
>>> midiout.write_short(0x74,124,0)
PortMidi call failed...
PortMidi: `Invalid MIDI message Data'
type ENTER...
As you can see, i'm sending 0x74,124,0. 如您所见,我正在发送0x74,124,0。 I'm taking those numbers from rakarrack (the application that i want to control) implementation chart: http://rakarrack.sourceforge.net/midiic.html 我从rakarrack(我要控制的应用程序)实现图表中获取这些数字: http ://rakarrack.sourceforge.net/midiic.html
What am I doing wrong? 我究竟做错了什么?
MIDI status bytes (the first byte of the message) must have the high (0x80) bit set. MIDI状态字节(消息的第一个字节)必须设置高(0x80)位。 the linked chart is a bit confusing, but I'm guessing 0x74 is a data byte and must be preceded by the proper status byte. 链接的图表有点混乱,但是我猜0x74是一个数据字节,必须在其前面加上正确的状态字节。
>>> import pygame.midi as midi
>>> midi.init()
>>> midiout = midi.Output(0)
>>> midiout.write_short(0xb0, 0x74, 124)
some basic MIDI documentation: http://www.midi.org/techspecs/midimessages.php 一些基本的MIDI文档: http : //www.midi.org/techspecs/midimessages.php
control change is 0xbn, where n is the channel number, so 0xb0 is a control change message for channel 0. 控制更改是0xbn,其中n是通道号,因此0xb0是通道0的控制更改消息。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.