Skip to content

Instantly share code, notes, and snippets.

@igneus
Created December 26, 2016 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igneus/bdd67b7bce2c125c6ce9e4d4f8474635 to your computer and use it in GitHub Desktop.
Save igneus/bdd67b7bce2c125c6ce9e4d4f8474635 to your computer and use it in GitHub Desktop.
Switch MIDI presets by piano pedals
# mididings patch translating piano pedals to Program switch messages
#
# I use it to switch presets in aeolus
from mididings import *
config(
client_name='pedal_channel_switch'
)
# MIDI ctrl ids
pedal_soft_ctrl = 67
pedal_sostenuto_ctrl = 66
pedal_sustain_ctrl = 64
# chosen to fit my needs
port = 1
channel = 11
def pedals_to_programs():
return CtrlSplit({
pedal_soft_ctrl: Program(port, channel, 1),
pedal_sostenuto_ctrl: Program(port, channel, 3),
pedal_sustain_ctrl: Program(port, channel, 2),
})
run({CTRL: pedals_to_programs(), NOTE: Pass()})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment