# Module `mididings.extra`

## Hooks

Hooks extend the functionality of mididings. Instances of these classes can be registered using the `hook()` function.

class MemorizeScene(memo_file)

  Saves the currently selected scene number to a file when terminating mididings, and restores it at the next startup.

  Parameters:

    memo_file – the path of the file to be used to store the scene number.

class AutoRestart(modules=True, filenames=[])

  Automatically restarts mididings when the script changes.

  This restarts the entire mididings script, so MIDI processing is interrupted, and mididings does not take care of reestablishing any ALSA/JACK connections that were made manually. If the new script contains errors that prevent it from running, mididings exits and needs to be restarted manually once the errors are fixed.

  Parameters:

    - modules – If true, all imported local Python modules are monitored for changes as well.

    - filenames – a list of additional files to be monitored.

  Defined in `mididings.extra.inotify`. Requires pyinotify.

class OSCInterface(port=56418, notify_ports=[56419])

  Allows controlling mididings via OSC.

  Parameters:

    - port – the OSC port to listen on.

    - notify_ports – a list of OSC ports to notify when the current scene changes.

  These messages are currently understood:

  - /mididings/switch_scene ,i: switch to the given scene number.

  - /mididings/switch_subscene ,i: switch to the given subscene number.

  - /mididings/prev_scene: switch to the previous scene.

  - /mididings/next_scene: switch to the next scene.

  - /mididings/prev_subscene: switch to the previous subscene.

  - /mididings/next_subscene: switch to the next subscene.

  - /mididings/panic: send all-notes-off on all channels and on all output ports.

  - /mididings/quit: terminate mididings.

  - /mididings/restart: restart mididings.

  Defined in `mididings.extra.osc`. Requires pyliblo3.

## General MIDI

The `mididings.extra.gm` module contains constants for program and controller numbers defined in the General MIDI standard.

### Programs

ACOUSTIC_GRAND_PIANO BRIGHT_ACOUSTIC_PIANO ELECTRIC_GRAND_PIANO HONKY_TONK_PIANO ELECTRIC_PIANO_1 ELECTRIC_PIANO_2 HARPSICHORD CLAVINET CELESTA GLOCKENSPIEL MUSIC_BOX VIBRAPHONE MARIMBA XYLOPHONE TUBULAR_BELLS DULCIMER DRAWBAR_ORGAN PERCUSSIVE_ORGAN ROCK_ORGAN CHURCH_ORGAN REED_ORGAN ACCORDION HARMONICA TANGO_ACCORDION ACOUSTIC_GUITAR_NYLON ACOUSTIC_GUITAR_STEEL ELECTRIC_GUITAR_JAZZ ELECTRIC_GUITAR_CLEAN ELECTRIC_GUITAR_MUTED OVERDRIVEN_GUITAR DISTORTION_GUITAR GUITAR_HARMONICS ACOUSTIC_BASS ELECTRIC_BASS_FINGER ELECTRIC_BASS_PICK FRETLESS_BASS SLAP_BASS_1 SLAP_BASS_2 SYNTH_BASS_1 SYNTH_BASS_2 VIOLIN VIOLA CELLO CONTRABASS TREMOLO_STRINGS PIZZICATO_STRINGS ORCHESTRAL_HARP TIMPANI STRING_ENSEMBLE_1 STRING_ENSEMBLE_2 SYNTH_STRINGS_1 SYNTH_STRINGS_2 CHOIR_AAHS VOICE_OOHS SYNTH_VOICE ORCHESTRA_HIT TRUMPET TROMBONE TUBA MUTED_TRUMPET FRENCH_HORN BRASS_SECTION SYNTHBRASS_1 SYNTHBRASS_2 | SOPRANO_SAX ALTO_SAX TENOR_SAX BARITONE_SAX OBOE ENGLISH_HORN BASSOON CLARINET PICCOLO FLUTE RECORDER PAN_FLUTE BLOWN_BOTTLE SHAKUHACHI WHISTLE OCARINA LEAD_1_SQUARE LEAD_2_SAWTOOTH LEAD_3_CALLIOPE LEAD_4_CHIFF LEAD_5_CHARANG LEAD_6_VOICE LEAD_7_FIFTHS LEAD_8_BASS_LEAD PAD_1_NEW_AGE PAD_2_WARM PAD_3_POLYSYNTH PAD_4_CHOIR PAD_5_BOWED PAD_6_METALLIC PAD_7_HALO PAD_8_SWEEP FX_1_RAIN FX_2_SOUNDTRACK FX_3_CRYSTAL FX_4_ATMOSPHERE FX_5_BRIGHTNESS FX_6_GOBLINS FX_7_ECHOES FX_8_SCI_FI SITAR BANJO SHAMISEN KOTO KALIMBA BAGPIPE FIDDLE SHANAI TINKLE_BELL AGOGO STEEL_DRUMS WOODBLOCK TAIKO_DRUM MELODIC_TOM SYNTH_DRUM REVERSE_CYMBAL GUITAR_FRET_NOISE BREATH_NOISE SEASHORE BIRD_TWEET TELEPHONE_RING HELICOPTER APPLAUSE GUNSHOT

### Controllers

CTRL_BANK_SELECT_MSB CTRL_MODULATION CTRL_DATA_ENTRY_MSB CTRL_VOLUME CTRL_PAN CTRL_EXPRESSION CTRL_BANK_SELECT_LSB CTRL_DATA_ENTRY_LSB CTRL_SUSTAIN CTRL_PORTAMENTO | CTRL_SOSTENUTO CTRL_SOFT_PEDAL CTRL_LEGATO_PEDAL CTRL_NRPN_LSB CTRL_NRPN_MSB CTRL_RPN_LSB CTRL_RPN_MSB CTRL_RESET_ALL_CONTROLLERS CTRL_ALL_NOTES_OFF