Skip to main content

MIDI Message Creation and Manipulation

The Smart Multibox has quite a few functions that allow you to create, send and receive MIDI messages. MIDI messages can also be created manually - they are actually Python bytearrays.

Message Creation Functions

midi_msg_make_1byte(msg_type)

Creates and returns a 1 byte MIDI message with the given message type. Message type constants are at the end of this page. 

midi_msg_make_cc(channel, number, value)

Creates and returns a MIDI CC (continuous controller) message with the given MIDI channel (1-16), number (0-127) and value (0-127).

midi_msg_make_chan_pressure(channel, note)

Creates and returns a MIDI channel pressure message with the given MIDI channel (1-16) and value (0-127).

midi_msg_make_note(channel, note, velocity)

Creates and returns a MIDI note message with the given MIDI channel (1-16), note number (0-127) and velocity (0-127). Using velocity of 0 is equivalent to a "note off".

midi_msg_make_pc(channel, number)

Creates and returns a MIDI PC (program change) message with the given MIDI channel (1-16) and number (0-127).

midi_msg_make_pitch_bend(channel, number)

Creates and returns a MIDI pitch bend message with the given MIDI channel (1-16) and number (0-16383).

midi_msg_make_poly_pressure(channel, note, value)

Creates and returns a MIDI channelpolyphonic pressure message with the given MIDI channel (1-16), note number (0-127) and value (0-127).

Message Manipulation Functions

    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_1byte), MP_ROM_PTR(&py_multibox_midi_msg_make_1byte_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_cc), MP_ROM_PTR(&py_multibox_midi_msg_make_cc_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_chan_pressure), MP_ROM_PTR(&py_multibox_midi_msg_make_chan_pressure_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_note), MP_ROM_PTR(&py_multibox_midi_msg_make_note_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_pc), MP_ROM_PTR(&py_multibox_midi_msg_make_pc_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_pitch_bend), MP_ROM_PTR(&py_multibox_midi_msg_make_pitch_bend_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_make_poly_pressure), MP_ROM_PTR(&py_multibox_midi_msg_make_poly_pressure_obj) },

    // Message manipulation functions
    { MP_ROM_QSTR(MP_QSTR_midi_msg_get_channel), MP_ROM_PTR(&py_multibox_midi_msg_get_channel_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_set_channel), MP_ROM_PTR(&py_multibox_midi_msg_set_channel_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_get_number), MP_ROM_PTR(&py_multibox_midi_msg_get_number_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_set_number), MP_ROM_PTR(&py_multibox_midi_msg_set_number_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_get_type), MP_ROM_PTR(&py_multibox_midi_msg_get_type_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_set_type), MP_ROM_PTR(&py_multibox_midi_msg_set_type_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_get_value), MP_ROM_PTR(&py_multibox_midi_msg_get_value_obj) },
    { MP_ROM_QSTR(MP_QSTR_midi_msg_set_value), MP_ROM_PTR(&py_multibox_midi_msg_set_value_obj) },