-
-
Save mlegore/477741b6b6a2c8f658d81d2c02de0974 to your computer and use it in GitHub Desktop.
# 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) |
Hi, I am on win10/live10 and I created the mpk249.py file and put it in the path you suggested. When I reload ableton, I notice that the knobs that used to control each track panning now do not control that anymore. Then I tried to put Operator in a midi track, enable the track and check if the knobs do anything (e.g. controlling the pitch) but they don't. Nothing happens. I also tried changing knobs behaviour (from MIDI to INC/DEC2) but no succe either....Can someone point me in the right direction ? Thanks!
They won't do anything on instruments alone. They are designed for macros. All the preset instruments have these.
What you can also do is check the logs for python errors. Nothing gets logged to the screen if the code is broken so you'll have to do some digging.
Hey, thanks for the hint. Still the macro knobs weren't moving. But adding the self.set_device_component(device) string made the trick also for me as maxcloutier13 pointed out!
Made an account just to thank you for this!! I just purchased an MPK249 yesterday and this solved so many issues I never would've solved on my own. Followed your instructions (placing in the MPK249 folder instead of the 261 folder) and it worked like a charm! Just need to figure out how to have additional mapped configs for other VSTs and plugins. Seriously, this is a lifesaver, thank you so much for your work!!!
Thank you sir <3
Things eventually started making sense. My solution was crude but I've fixed all 3 problems I had with my MPK261.
1 - Encoders automap to current track device.
2 - Encoders are actually using the relative mode...
3 - And the B and C banks are fully working for a nice 24 track arming and volume control.
Thanks again mlegore. This post was the start of the rabbit hole ;o)
Feel free to steal my trick.