nerdfever.com
nerdfever.com

Reputation: 1782

How to force a MIDI device to report control status?

I'm using python-rtmidi to read a MIDI device with sliders and knobs.

I get CONTROL_CHANGE events whenever a slider moves or a knob is turned (this works fine).

But how can I poll the MIDI device to find out the initial position of the sliders and knobs when my program starts?

The user hasn't moved anything, so no CONTROL_CHANGE messages are sent.

(I don't have any documentation for the MIDI device; it's a "WORLDE Easycontrol 9"; I'm just trying to use standard MIDI messages.)

Also - while I have your attention - is there a standard command to turn the button LEDs on/off? I've tried sending CONTROL_CHANGE commands to the button's controller number (values 0 and 127), but the LEDs only light when the buttons are manually pushed.

My existing code:

import rtmidi

class Midi:

    CONTROL_CHANGE = 0xB0

    def __init__(self, port=0):
        self.midi_in = rtmidi.MidiIn() # gets BUT DOES NOT OPEN a midi input port
        self.midi_out = rtmidi.MidiOut()

        try:
            self.midi_in.open_port(port)
            self.midi_out.open_port(port)

            self.running = True

        except:
            self.running = False # in case there was no such MIDI port

    def read(self):

        if self.running:
            event = self.midi_in.get_message()

            if event:
                return event[0]

        return None

    def write(self, message):
        if self.running:
            self.midi_out.send_message(message)

Upvotes: 1

Views: 727

Answers (2)

Knut Mann
Knut Mann

Reputation: 11

This is probably way too late, but for the device I am using, LEDs for buttons are controlled by sending noteOn or noteOff packets using the same key that is transmitted when pressing the button. I found this document helpful, even though its not for my device:

https://www.numark.com/images/product_downloads/dj2go___software_definition_and_midi_spec_v1.0.pdf

Upvotes: 1

CL.
CL.

Reputation: 180250

The official MIDI specifications do not define a mechanism to read the current status of a control. However, many device have vendor-specific commands to start a bulk parameter dump.

Whether controls can be changed from the computer is device specific.

Upvotes: 2

Related Questions