Skip to content

Instantly share code, notes, and snippets.

@mlegore
Last active December 19, 2022 23:01
Show Gist options
  • Save mlegore/477741b6b6a2c8f658d81d2c02de0974 to your computer and use it in GitHub Desktop.
Save mlegore/477741b6b6a2c8f658d81d2c02de0974 to your computer and use it in GitHub Desktop.
My custom MPK249 control script for Ableton Live. Only tested on Windows 10 & Live 10. It fixes the automap for device knobs to automap to the knobs able the 249's sliders. Go to C:\ProgramData\Ableton\Live 10 Suite\Resources\MIDI Remote Scripts\MPK249 and make a backup of that folder and put this script in the folder and restart Ableton.
# Embedded file name: c:\Jenkins\live\output\win_64_static\Release\python-bundle\MIDI Remote Scripts\MPK249\MPK249.py
from __future__ import absolute_import, print_function, unicode_literals
from _Framework.ControlSurface import ControlSurface
from _Framework.Layer import Layer
from _Framework.DrumRackComponent import DrumRackComponent
from _Framework.TransportComponent import TransportComponent
from _Framework.DeviceComponent import DeviceComponent
from _Framework.MixerComponent import MixerComponent
from _Framework.MidiMap import MidiMap as MidiMapBase
from _Framework.MidiMap import make_button, make_encoder, make_slider
from _Framework.InputControlElement import MIDI_NOTE_TYPE, MIDI_CC_TYPE
class MidiMap(MidiMapBase):
def __init__(self, *a, **k):
super(MidiMap, self).__init__(*a, **k)
self.add_button(u'Play', 0, 118, MIDI_CC_TYPE)
self.add_button(u'Record', 0, 119, MIDI_CC_TYPE)
self.add_button(u'Stop', 0, 117, MIDI_CC_TYPE)
self.add_button(u'Loop', 0, 114, MIDI_CC_TYPE)
self.add_button(u'Forward', 0, 116, MIDI_CC_TYPE)
self.add_button(u'Backward', 0, 115, MIDI_CC_TYPE)
self.add_matrix(u'Sliders', make_slider, 0, [[12,
13,
14,
15,
16,
17,
18,
19]], MIDI_CC_TYPE)
self.add_matrix(u'Encoders', make_encoder, 0, [[22,
23,
24,
25,
26,
27,
28,
29]], MIDI_CC_TYPE)
self.add_matrix(u'Arm_Buttons', make_button, 0, [[32,
33,
34,
35,
36,
37,
38,
39]], MIDI_CC_TYPE)
self.add_matrix(u'Drum_Pads', make_button, 1, [[81,
83,
84,
86],
[74,
76,
77,
79],
[67,
69,
71,
72],
[60,
62,
64,
65]], MIDI_NOTE_TYPE)
class MPK249(ControlSurface):
def __init__(self, *a, **k):
super(MPK249, self).__init__(*a, **k)
with self.component_guard():
midimap = MidiMap()
drum_rack = DrumRackComponent(name=u'Drum_Rack', is_enabled=False, layer=Layer(pads=midimap[u'Drum_Pads']))
drum_rack.set_enabled(True)
transport = TransportComponent(name=u'Transport', is_enabled=False, layer=Layer(play_button=midimap[u'Play'], record_button=midimap[u'Record'], stop_button=midimap[u'Stop'], seek_forward_button=midimap[u'Forward'], seek_backward_button=midimap[u'Backward'], loop_button=midimap[u'Loop']))
transport.set_enabled(True)
device = DeviceComponent(name='Device', is_enabled=False, layer=Layer(parameter_controls=midimap['Encoders']))
device.set_enabled(True)
mixer_size = len(midimap[u'Sliders'])
mixer = MixerComponent(mixer_size, name=u'Mixer', is_enabled=False, layer=Layer(volume_controls=midimap[u'Sliders'], arm_buttons=midimap[u'Arm_Buttons']))
mixer.set_enabled(True)
@participationaward
Copy link

Thank you sir <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment