Ableton Control Surface API (Send MIDI Note ON to the Control Surface)

Discuss music production with Ableton Live.
Post Reply
Avshalom
Posts: 1
Joined: Wed Feb 26, 2014 7:29 pm

Ableton Control Surface API (Send MIDI Note ON to the Control Surface)

Post by Avshalom » Sun Oct 17, 2021 9:26 am

Hi
I'm looking for a documentation / sdk / boilerplate example for Ableton Control Surface Python API.
If none is available, can someone please post an example on how to send a midi command to the control surface ?
I'm trying to send the scene names to my controller via the python control surface script, I already get the scene name via Live's Song properties (self.song.view.selected_scene.name), what I want to do is to send it (via ASCII code that I'll be translated as MIDI Note ON to my control surface)..
I can't find any example that shows how to send a midi note on to the control surface.

Help will be much appreciated !

Arthur Montvidas
Posts: 11
Joined: Sat Oct 16, 2021 3:33 pm

Re: Ableton Control Surface API (Send MIDI Note ON to the Control Surface)

Post by Arthur Montvidas » Tue Oct 19, 2021 3:21 pm

Hi.
You can find many useful information in decompiled Mackie Control script
https://github.com/gluon/AbletonLive10. ... kieControl
In example, to send NOTE_ON to control surface they use self.send_midi((NOTE_ON_STATUS, SID_JOG_SCRUB, BUTTON_STATE_ON))

def send_midi(self, midi_event_bytes):
u"""Use this function to send MIDI events through Live to the _real_ MIDI devices
that this script is assigned to."""
self.__c_instance.send_midi(midi_event_bytes)

To send text: display.send_display_string(upper_string, 0, 0)

def send_display_string(self, display_string, display_row, cursor_offset):
if display_row == 0:
offset = cursor_offset
elif display_row == 1:
offset = NUM_CHARS_PER_DISPLAY_LINE + 2 + cursor_offset
else:
assert 0
message_string = [ ord(c) for c in display_string ]
for i in range(len(message_string)):
if message_string >= 128:
message_string = 0

if self.__last_send_messages[display_row] != message_string:
self.__last_send_messages[display_row] = message_string
if self.main_script().is_extension():
device_type = SYSEX_DEVICE_TYPE_XT
else:
device_type = SYSEX_DEVICE_TYPE
display_sysex = (240,
0,
0,
102,
device_type,
18,
offset) + tuple(message_string) + (247,)
self.send_midi(display_sysex)

Post Reply