mididings - Submodules Reference

Submodules

mididings.event

This module defines classes and functions for dealing with MIDI events in Python code, e.g. using Process() or Call().

MidiEvent(type, port, channel, data1, data2)

The class used as the MIDI event data type inside the Process() and Call() units.

A MidiEvent object has the following attributes:

There are also aliases for these attributes, some of which are only valid for certain types of events:

NoteOnEvent(port, channel, note, velocity)
NoteOffEvent(port, channel, note, velocity=0)
CtrlEvent(port, channel, ctrl, value)
ProgramEvent(port, channel, program)
PitchbendEvent(port, channel, value)
AftertouchEvent(port, channel, value)
SysExEvent(port, sysex)

Auxiliary functions to create new MidiEvent objects of a certain type.

mididings.engine

This module contains functions to query or control the state of the mididings event processing engine from Python code.

switch_scene(scene, subscene=None)
switch_subscene(subscene)

Switches the current scene and/or subscene.

current_scene()
current_subscene()

Returns the current scene or subscene number.

scenes()

Returns a dictionary of all scenes. Keys are scene numbers, values are tuples containing the scene name and a (possibly empty) list of subscene names.

output_event(ev)

Sends a MIDI event directly to an output port, completely bypassing any other event processing.

in_ports()
out_ports()

Returns a list of the configured input/output port names.

time()

Returns the time in seconds (floating point) since some unspecified starting point. Unlike Python's time.time(), this clock is guaranteed to be monotonic.

active()

Returns True if the mididings engine is active (the run() function is running).

restart()

Restarts the mididings script by terminating the current process, and then running the same Python interpreter with the same arguments again. This will not work properly if run() is not the last call in your script, or if you're running mididings in an interactive Python interpreter.

quit()

Terminates mididings event processing (by making the run() function return).

mididings.util

This module contains various utility functions.

note_number(note)

Converts a note name to a MIDI note number.

note_range(notes)

Converts a note range string to a tuple of MIDI note numbers.

note_name(note)

Returns the note name for the given MIDI note number.

controller_name(ctrl)

Returns the GM controller name for the given controller number.

port_number(port)

Returns the port number corresponding to the given port name. If input and output ports exist with the same name but different index, the number of the input port is returned.