mididings - Core Module Reference



Changes global mididings settings. This should be called only once, before constructing any processing units.
Possible keyword arguments are:


Registers "hook" objects, that can be used to extend the functionality of mididings.


Starts the MIDI processing. This is usually the last function called by a mididings script.

run(scenes=..., control=None, pre=None, post=None)

Starts the MIDI processing, using multiple scenes. The SceneSwitch() unit can be used to switch between these scenes.

process_file(infile, outfile, patch)

Requires mididings to be compiled with support for libsmf.
Reads a standard MIDI file, processes it, then writes the result back to a file.


Scene(name, patch, init_patch=None)

Constructs a Scene object to be used with the run() function.

SceneGroup(name, [subscene, ...])

Constructs a SceneGroup object. This can be used to group multiple scenes under a common name and program number. Each of the subscenes should be a Scene object.

Define one scene (song) with 3 subscenes (parts):
SceneGroup("Example Song", [
    Scene("Intro", intro_patch),
    Scene("Verse", verse_patch),
    Scene("Chorus", chorus_patch),


Event Types

Every event has one of these types:

For use in filters, the following constants are also defined:

Event types are bit masks, so when building filters, they can be combined using | (bitwise or) and ~ (bitwise negation).

Event Attributes

These constants are used by generator units and the SceneSwitch() unit to refer to an event's data attributes: