简体   繁体   中英

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). The idea is to send from the output (from this python program) to the input of another program.

>>> 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. I'm taking those numbers from rakarrack (the application that i want to control) implementation chart: 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. 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.

>>> 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

control change is 0xbn, where n is the channel number, so 0xb0 is a control change message for channel 0.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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