Learning Midi Remote Scripts

Share your Ableton Live secrets here
Post Reply
lophMusic
Posts: 7
Joined: Thu Feb 11, 2021 9:23 pm

Learning Midi Remote Scripts

Post by lophMusic » Sat Feb 20, 2021 9:37 pm

Hello forum! :)

I've spent some time tying to learn how to write Midi Remote Scripts using Python with Ableton 10. For that matter, I've learned most of the things by "Try & Error", this awesome tutorial about _Framework (remotescripts.blogsport.com)
and this API Documentation (www.structure-void.com).

Though, I'm slowly getting a grip on coding _Framework, there're still a couple of things, I keep wondering about:
1. Browsing the Ableton scrtipt directory, I've noticed scripts called "_Tools" (seems to be legacy-code from Ableton 6), "_UserScript" and most of all "_Generic". Does anybody have information about these classes, or a least point me into the direction to find those informations myself?

2. Like I said before: I did most of my own 'training' using _Framework, but the current scripts don't use those classes anymore, instead they use some classes to be found in ./ableton/v2/*. So, in order to adjust the functionality of my current Masterkeyboard with my own code, I feel like I have to understand those classes better. Again: Any help to find more information on those classes is much appreciated.

Unfortunately it's somehow very hard to find any information about scripting ableton > version 9, so I'm really running out of ideas where to look...

The Rabbits
Posts: 89
Joined: Tue Apr 07, 2020 2:23 pm

Re: Learning Midi Remote Scripts

Post by The Rabbits » Sun Feb 21, 2021 8:59 am

Have a look here for decompiled versions of all the standard scripts.

github/gluon/AbletonLive11_MIDIRemoteScripts

I found a few useful bits here, but there is no useful documentation. The main thing I got from digging through the code was the limitations of the model.

I've been doing the same over the last month or so. Taking the opportunity to learn Python as well as making controlling live with my Launchkey more efficient.

Those limitations are frustrating!!

bxn
Posts: 13
Joined: Sun Nov 08, 2020 3:02 pm

Re: Learning Midi Remote Scripts

Post by bxn » Mon Mar 01, 2021 10:25 pm

[mod edit]
BXN, your message was breaking the terms of the ClyphX Pro EULA so I deleted it.
You're welcome to share info/knowledge, but make sure first that you have the rights to do so - especially when it's about decompyling code.
thx


lophMusic
Posts: 7
Joined: Thu Feb 11, 2021 9:23 pm

Re: Learning Midi Remote Scripts

Post by lophMusic » Fri May 14, 2021 10:19 pm

Thanks for all your helpful answers.

I still find it difficult to find any information about remote scripts.

Right now I have the following problem:
I'm trying to use four buttons to navigate through tracks and scenes, so I can arm (or solo, or mute) the selected track.

For this I'm using ./ableton/v2/[...] classes, because the script I'm trying to modify uses them.

To 'session-record', I've reused previous code:

Code: Select all

	self._session_recording = SessionRecordingComponent(name=u'Session_Recording', is_enabled=False, layer=Layer(record_button=self._record_button))
        self._session_recording.set_enabled(True)
To navigate through tracks (left/right) and scenes (up/down), I've found ViewControlComponent()

Code: Select all

	    self._view_control = ViewControlComponent()
            self._view_control.set_next_track_button(self._pad[3])
            self._view_control.set_prev_track_button(self._pad[1])
            self._view_control.set_prev_scene_button(self._pad[6])
            self._view_control.set_next_scene_button(self._pad[2])
To arm a selected track, I've added a value_listener to the pad that should arm the track when pressed

Code: Select all

# In __init__()
	self._pad[0].add_value_listener(self.pad1_callback)

#later...
def pad1_callback(self, value):
        if not value:
            return
	 selected_track = self._transport.song.view.selected_track
         name = selected_track.name
         self._current_strip.set_arm_button(None)
         self._mixer._selected_strip.set_arm_button(self._pad[0]) # any but this line don't seem to be necessary
         self._current_strip = self._mixer._selected_strip
The problem is:
That code seems to work, unless I've finished recording a couple of clips (with the playback always running). Then the arm_button keeps activating the same track, no matter which one is currently selected. When that happens, I have to restart the playback and things are working again for some time.

To tell the truth, I just have a rough conception of what I'm doing, because lots and lots of try-and-error was involved to get to the code, I'm using right now.

Any help on thatone is appreciated.

I also have tons of little questions, but this ableton forum seems to be the only place to ask questions about remote scripts, but on the other hand I don't want to bore you to death with a lot of little silly questions (e.g. "what's the difference between track and strip?" "what's a session_ring supposed to be for?" "what's a tracks_provider?" etc..)

So, if anyone knows a good place to ask stupid remode script related questions, I'd appreciate that, too.

lophMusic
Posts: 7
Joined: Thu Feb 11, 2021 9:23 pm

Re: Learning Midi Remote Scripts

Post by lophMusic » Sat May 15, 2021 6:10 pm

Okay, I've found a workaround. I don't use set_arm_button() of ViewControlComponent anymore, but used the Live-API instead:

Code: Select all

	    selected_track = self._transport.song.view.selected_track
            name = selected_track.name
            name_prev = self._current_track.name   

            if selected_track.can_be_armed:
                if self._current_track.name != selected_track.name: # ugly but works for now
                    self._current_track.arm = False
                    
                selected_track.arm = not selected_track.arm

                self._current_track = selected_track
Still, I'm confused like hell :) I feel so lonely learning those things...

lophMusic
Posts: 7
Joined: Thu Feb 11, 2021 9:23 pm

Re: Learning Midi Remote Scripts

Post by lophMusic » Mon Jul 12, 2021 7:30 am

########################## Update ######################
By now, I've been pretty happy with my results coding a remote script for my master keyboard.

But now, I've hit two problems. I hope you don't consider it spam, when I keep posting my litte problems in here.

1st Problem: find a "select Track" function.
I'm using the _Framework Classes (and some API-Calls) and can't find a way to select a track from within my script. Like: "select master track" or "select track number two". I'm sure, I'm missing out something here...

2nd Problem: Is there a way to 'intercept' a key-press of a different driver/device?
Is it possible to react to a CC that's sent out by a different device? (Probably not, I guess)

On last thing:
I've noticed the script is loaded _twice_ after the ableton startup. So at the start of Ableton, it's loaded, de-loaded and loaded again. Is there any explanation to that?

That is it for now ;)

Yaman29
Posts: 6
Joined: Fri Jul 02, 2021 8:37 am

Re: Learning Midi Remote Scripts

Post by Yaman29 » Mon Jul 12, 2021 10:53 am

lophMusic wrote:
Mon Jul 12, 2021 7:30 am
1st Problem: find a "select Track" function.
I'm using the _Framework Classes (and some API-Calls) and can't find a way to select a track from within my script. Like: "select master track" or "select track number two". I'm sure, I'm missing out something here...
Do you know this resource: Selected Track Control for Ableton Live?
http://stc.wiffbi.com
You can download the scripts (they are decompiled, so you can take a look at it how it was made).

lophMusic
Posts: 7
Joined: Thu Feb 11, 2021 9:23 pm

Re: Learning Midi Remote Scripts

Post by lophMusic » Sat Jul 17, 2021 10:52 pm

Thank you very much for your reply Yaman29!

Yes, I know "Selected Track Control", but I didn't find a solution there.
Still you showed me the right way in an 'earlier version' of your reply mentioning the "Mackie Control" script (more precise: the function __select_track(self) inside ChannelStrip.py)

The solution:
All I had to do was to set "self.song().view.selected_track" - and that's it! Although I was looking for something like this in the 'Live.Application.Application.View'-class, I somehow missed thatone (and feel a bit embarrassed about it ;)), so thanks a _lot_ for pointing me into the right direction! :)

About my 2nd problem:
I'm afraid I wasn't precise describing my problem:
I'm trying to remote-control ableton with my Keyboard (Roland FA-07). It has it's own Midi-Driver for stuff like that (called "DAW-control", which utilises the transport-buttons and encoders and stuff), but I also want to use a foot-pedal to start/stop audio-recordings. The problem is, the Roland doesn't transmit the pedal-CC over that 'daw-control' interface, but uses a seperated Midi-interface for that (called "FA-0608" used for the 'regular keyboard playing').
So I'm looking for a way to get that into my script. But right now, I think, I'll just have to write another small script for the "FA-0608" interface, handling the foot-pedal.

Yaman29
Posts: 6
Joined: Fri Jul 02, 2021 8:37 am

Re: Learning Midi Remote Scripts

Post by Yaman29 » Sun Jul 18, 2021 7:27 am

lophMusic wrote:
Sat Jul 17, 2021 10:52 pm
The solution:
All I had to do was to set "self.song().view.selected_track" - and that's it! Although I was looking for something like this in the 'Live.Application.Application.View'-class, I somehow missed thatone (and feel a bit embarrassed about it ;)), so thanks a _lot_ for pointing me into the right direction! :)
Glad I could help you.

About your 2nd problem: are you on Windows or Mac?

lophMusic
Posts: 7
Joined: Thu Feb 11, 2021 9:23 pm

Re: Learning Midi Remote Scripts

Post by lophMusic » Thu Jul 22, 2021 8:57 am

I'm using Windows most of the time.

I've already considered using a virtual midi port to 'tunnel' the foot-pedal CC to my script, but I thought I wouldn't gain anything, since I'd had to run a seperated program to create to virtual port/midi filter. So maybe just two scripts inside Ableton (the one I'm already using and the otherone just to poerate the foot switch) is just as good.^


EDIT:
Hehe, okay - now I really start feeling a little retarded, because as it seems, I always need a little hint (from Yaman29) and then I can answer my own questions.
Now: I have implemented a second script to handle the food-switch. And it works. But then I remembered, I already had coded a python-script that has 'midi filter capabilities' (using rtmidi) and it also runs on 3 different OS (Linux, Windows and osx). So, if I could manage to get rtmidi inside my ableton-remote-script, that'd be awesome. That could take some time, though ...

So thanks once again Yaman29 for the right words at the right time - and sorry to the others for bothering you with my continuous self-talk ;)

Post Reply