midi

class platypush.plugins.midi.MidiPlugin(device_name='Platypush virtual MIDI output', **kwargs)[source]

Virtual MIDI controller plugin. It allows you to send custom MIDI messages to any connected devices.

Requires:

  • python-rtmidi (pip install python-rtmidi)

__init__(device_name='Platypush virtual MIDI output', **kwargs)[source]
Parameters

device_name (str) – MIDI virtual device name (default: Platypush virtual MIDI output)

play_note(note, velocity, duration=0)[source]

Play a note with selected velocity and duration.

Parameters
  • note (int) – MIDI note in range 0-127 with #60 = C4

  • velocity (int) – MIDI note velocity in range 0-127

  • duration (float) – Note duration in seconds. Pass 0 if you don’t want the note to get off

query_ports()[source]
Returns

dict: A list of the available MIDI ports with index and name

release_all_notes()[source]

Release all the notes being played.

release_note(note)[source]

Release a played note.

Parameters

note (int) – MIDI note in range 0-127 with #60 = C4

send_message(values)[source]
Parameters

values (list[int]) – Values is expected to be a list containing the MIDI command code and the command parameters - see reference at https://ccrma.stanford.edu/~craig/articles/linuxmidi/misc/essenmidi.html

Available MIDI commands:
  • 0x80 Note Off

  • 0x90 Note On

  • 0xA0 Aftertouch

  • 0xB0 Continuous controller

  • 0xC0 Patch change

  • 0xD0 Channel Pressure

  • 0xE0 Pitch bend

  • 0xF0 Start of system exclusive message

  • 0xF1 MIDI Time Code Quarter Frame (Sys Common)

  • 0xF2 Song Position Pointer (Sys Common)

  • 0xF3 Song Select

  • 0xF6 Tune Request (Sys Common)

  • 0xF7 End of system exclusive message

  • 0xF8 Timing Clock (Sys Realtime)

  • 0xFA Start (Sys Realtime)

  • 0xFB Continue (Sys Realtime)

  • 0xFC Stop (Sys Realtime)

  • 0xFE Active Sensing (Sys Realtime)

  • 0xFF System Reset (Sys Realtime)