Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top