sample code

The script provides a GUI for mapping MIDI drum pad input into pneumatic valve commands. The script and libraries are packaged as The individual files can be browsed at and kf.

Graphical user interface to a set of Arduino-controlled pneumatic valves.

class valves1.AppWindow(main)[source]

A custom main window which provides all GUI controls. This generally follows a model-view-controller convention in which this window provides the views, passing events to the application controller via callbacks.


Apply the persistent configuration values from a configparser section proxy object.


Qt callback received before windows closes.


Finish initializing the GUI by connecting all callbacks from GUI elements to application controller methods. This allows the log window to be set up early to capture any messages from the initialization of other object.


Update the persistent configuration values in a configparser section proxy object.


Update the status bar at the bottom of the display to show the provided string.

class valves1.MainApp[source]

Main application controller object holding any non-GUI related state.


Callback to be invoked right after the main event loop begins. This may be extended in child classes to implement startup behaviors which require a running event loop.


Callback invoked right before the program ends, either from a keyboard interrupt window close. This may be extended in child classes to clean up external resources, e.g., close any serial ports to remove associated lock files.


Method to add default configuration values. This is intended to be extended in child classes. It is called during object initialization.


Method to save the current configuration file. This is not called by default, it must be invoked explicitly by child classes.

class valves1.ValveMIDILogic(main)[source]

Core performance logic for processing MIDI input into valve commands.

channel_pressure(channel, pressure)[source]

Process a MIDI Channel Pressure event.

control_change(channel, cc, value)[source]

Process a MIDI Control Change event.

note_off(channel, key, velocity)[source]

Process a MIDI Note Off event.

note_on(channel, key, velocity)[source]

Process a MIDI Note On event.

set_speed(valve_index, speed)[source]

Map a given valve index to the particular valve set.