Ableton Live 9 Python remote scripts

Mar 3, 2013 - 23:37

I just finished my small job : decompiling Python MIDI remote scripts for the PUSH controller.

But finally, I decompiled ALL Ableton Live 9 Remote Scripts =)

I’d suggest you to read this : http://julienbayle.net/ableton-push and especially the part about MIDI Remote Scripts.

I’m not proud at all but just very happy to be able to deliver all sources just one day before the official Ableton Live 9 Release :)

Push Python Scripts

 

How this wizardry works ?
Basically, a MIDI Remote script is just a piece of code enabled when you use a MIDI controller already known by Ableton Live and able to be directly recognized as a remote surface.
This is a piece of code very efficient and smart used as an interface between the remote surface and Live itself.
Every features available in the python side of things in Live is also available in Max for Live.
But Python doesn’t require Max for Live and for some people that could be very interesting to code some specific interface behaviors for their own surfaces.

Python scripts source codes are not provided by Ableton.
This is a choice we all have to respect and they obviously know we can hack some stuff here and they also respect that afaik.

Basically, bytecode is “a kind of” binary executable. When you go into Preferences > MIDI Sync, you can choose a remote surface amongst a big list of surfaces. This list is populated by (valide) python bytecode organized and sorted in some folders in Ableton Live folders. Check MIDI Remote Scripts.

Ableton Preferences Control Surfaces

As soon as you select a surface, Live activates the corresponding script.

The magic, now: in case you are able to find the global framework/api etc and you are able to code your own scripts, Live would even compile them to bytecode and run them !

The second magic is here: I decompiled all remote scripts today and especially (and at first) the PUSH remote scripts.
EVERY pieces of behaviors of the PUSH is inside the script, not inside the PUSH, please keep that in mind !

The Ableton Push’ Remote Scripts

Here they are: https://github.com/gluon/AbletonLive9_RemoteScripts




57 Comments

57 Comments

  • [...] Bayle was kind enough to decompile all of the Ableton Python Remote Scripts and post them up on his site and github.  Taking those scripts, I used epydoc to create the documentation for them. This should [...]

  • Thanks for these! How did you decompile them? I’ve tried a few decompilers and never had any luck. I would like to decompile NI’s scripts that they wrote for Maschine to work with Ableton. They currently crash in Ableton 9 so I’d like to fix them.

    Also I ran epydoc on the Framework so we have some nice fancy documentation now for the Framework.

    http://midicontrolfreaks.com/_Framework_901/

    • hey :D
      currently doing the same epydoc stuff.
      I also dumped Live children objects themselves… just need more time to push that on the website :)

      • Any tips on how to get NI’s Maschine pyc’s decompiled?

        • send me those scripts I’ll make it
          the unique page to spread and remember is
          http://julienbayle.net/ableton-live-9-midi-remote-scripts/

        • Check the repository. I pushed the sources of L8 Maschine scripts there.

        • FYI deeflash, NI has updated their Maschine MIDI remote scripts for Live 9 (check your Service Center). I provided them to Julien and he has kindly decompiled them and pushed them to the existing repository.

  • Dear Julien,

    Thank you for your works, it’s a great help.
    I wanted to use your decompiled launchpad scripts as a base and alter them a bit.
    But if I just compile your launchpad code and use it, the functionality is already broken:
    When switching from session-mode to another and than back, it won’t react on any button pressure.
    Maybe it’s a mac-pc-thing and the Python scripts are not exactly the same. I’m on PC.

    How did you decompile the python-scripts? They are larger than 5kb so depython won’t work. :)

    salut,
    Simon

    • I finally managed to decompile my the launchpad script, too. And there are absolutly no differences to your version.

      It’s weird: I can use the original compiled script from Ableton and it works like charm.
      But when I decompile it and re-compile it afterwards it won’t work.
      How can that happen?

      • indeed, that’s weird.
        afaik, they won’t put some checksum or stuff like that to disallow us to make that.

    • I didn’t decompile the latest version. I should. I don’t have time, sorry for that.

  • Hello Julien. For a lark I tried doing an edit to the InstrumentComponent as I would like the offset to be x4 instead of x3 in order to get some more range onto the scales interface. I removed the factory InstrumentComponent and replaced it with the .py file, and it compiled, but my controller became unresponsive, so it appears there is something I’m missing…

    Do I need to download the entire set of decompiled scripts and set them up as a custom controller for this to work or should Ableton compile individually edited scripts?

    Thanks for this awesome work that you do! This will be the gateway for numerous mods for existing controllers that bring lots of Abes the new features we see in Push.

    S!

    • best idea is : modifying progressively in order to be able to debug/troubleshoot easier.
      – so, backup ALL your .pyc original files,
      – then grab a .py,
      – modify it and push it to the correct folder
      – restart Live (it should “recompile” the freshly edited .py)
      – check and eventually undo.

  • [...] wealth of info about scripts + hacking them at Julien Bayle’s website which helped me figure out this Browser modification. For this tutorial, I’ll focus on just the changes that achieve Browser [...]

  • http://www.youtube.com/watch?v=v9MRT78bOt0

    An in-depth addition to DJ Limbs tutorial on how to customise the Ableton Push browsing ability and batch VST presets into the Ableton library. Kontact presets will be used as an example.

    • really interesting :)
      thanks for having shared it!

  • Which version of Python are these scripts? And, which decompiler are you using? Thanks!

  • Thanks for the reply. Still wondering which decompiler you used. Best regards.

    • I got uncompyle2 to do a good job on the latest 9.0.4 BrowserComponent.pyc
      there doesn’t appear to be many major changes to it since 9.0.2 apart from a few different things in grammar, and return lines at the end of some functions that didn’t have them before. none the less, i haven’t gotten the new uncompiled file to work with 9.0.4 on push. when i click browser i get – “nothing to browse” on the controller.

  • Hi, thanks so much for all your work! Seems my Push breaks when I replace the Remote Scripts folder with the one from Github though, and it doesn’t respond to anything anymore. Just says “Please start Live to play…”…

    • I’d strongly suggest to replace ONLY small numbers of scripts at a time.
      I mean: you modify one, you test it etc..

      • Ah clever. I tried replacing only ClipControlComponent.pyc but then the clip control breaks.. maybe that .pyc is erroneous. I will see if I can find a decompiler and decompile the files I have in my 9.0.4 installation :)

        • py comes from the original pyc and seems perfectly ok.
          before anything else, remove the ClipControlComponent.pyc and include only the py. Live will recompile it. or maybe this is what you have done..

          • Yes, that’s what I did, and I tried it again now to no avail. The display updates properly but the knobs break. The original .pyc is 31,338 bytes big and the rebuilt one is 32,333 bytes so there’s probably some small difference somewhere in the file..

        • you can try to verify if magic numbers are the same.

          • Hmm. They are. Don’t really know what to do now. The decompiled .py worked for you?

        • didn’t test this one especially (afaik..)

          • Thanks for your help. I’m at a loss. I compared the original file to the new one using an online tool called pyc_xray and it seems that the only discernible difference is some new lines of code in the beginning of the file resulting in a line offset (rest of info seems to be the same) and the filename variable which is ‘/Volumes/Jenkins/live/Projects/AppLive/Resources/MIDI Remote Scripts/Push/ClipControlComponent.py’ in the new version, compared to ‘/Applications/Ableton Live 9 Suite.app/Contents/App-Resources/MIDI Remote Scripts/Push/ClipControlComponent.py’ in the original.

      • indeed, comments are ignored in compilation ..

        • I just noticed the the Key/MIDI In/Out lights don’t flash at all with the new version of the file. They work with other channels and devices but for Clip Control, Live isn’t reporting any messages at all.. any thoughts?

  • Hello Julien I have a weird problem sending midi CC from 2 controllers(nanokontrol and vestax VCI-100) to Live 9, these are not in the list of ableton controllers, the issue is that the parameter jumps everywhere when i move the knob. Do you think i could fix it up with the remote scripts, would be nice if you could give any suggestion. Thanx for you work!

  • same problem here (like jzak) with decompiled files. I wanted to modify the generic controller or let me say use it as code base for a custom script. but after replacing the GenericScript.pyc with the decompiled version it just breaks the whole thing. So I tried decompiling myself the version from 9.0.6 and the only difference seems to be the file path in the beginning. There seems to be something that is missed by the decompiler.

  • Okay so you “decompiled” them? oO Decompiling means open the folder or what?

  • Hi Julien,

    Thanks for all the work you’ve done here – that no one else is doing. :)

    My name is Ryan and this last December I too became an Ableton Certified Trainer, so I am taking things to the next level now with your Python work.

    I’m not terribly tech-savvy, but I’m fumbling around. I found your “InstrumentComponent.py” and made an edit to the “Scale layout” with the hopes of adding “5th horizontal” to the way the pads are laid out.

    Therefore I made this edit to the “InstrumentComponent.py” file:

    self._line_names = recursive_map(DisplayDataSource, ((‘Scale layout:’,), (‘5th ^’, ‘4th ^’, ‘4th >’, ‘3rd ^’, ‘3rd >’, ‘Sequent ^’, ‘Sequent >’, ”, ”)))
            self.add_mode(‘scale_p5_vertical’, partial(self._set_scale_mode, True, 4), self._line_names[1][0])

    I don’t know if it’s correct, but it seemed the logical edit to make. Maybe you could help out here if it’s not correct.

    Now, how do I recompile the .py file into a .pyc fie? When I put the .py file into the MIDI Remote Scripts->Push folder, it doesn’t seem to work.

    • Live contains an engine that recompiles it automatically.
      BUT since 8.3 (if I remember correctly), it caches stuff so you have to remove the .pyc and to restart Live if it doesn’t recompile.

    • Hi Ryan,
      Is it working ? I also want to change de grid layout to 5th^
      Thanks

      • I can’t get it to work. :(

        I figured there must be something that I don’t understand (i’m not a “programming” person), so I gave it to a python programmer and he also couldn’t get it to work.

        Whether I put a .py or .pyc file back into the Push folder, when I restart Live and switch my Push on, none of the pads light up and it just says “Start Ableton” in the Push LCD display.

        I don’t know what to do about it.

  • I need remote script for my alesis qx61! heeeeelp!!!

  • Hello,

    great work Julien!

    I am creating my own functions scripting with Python and everything works fine, but I wish I could call each of this functions through MIDI.
    I only find I can call some API functions through MIDI, but I don´t know how to run my own functions.
    Is there any way to get it?

    For example:

    def my_function(self):
    a=25

    and now I want to run this function from a MIDI controller. Do you know how can I do that?

    Thanks in advance.
    Ruben

  • Howdy Y’all, I’m looking for a way to use Push as a controller within Maschine and I want the “In Key” mode to function. Basically I just want 64 Maschine pads which all are in whatever key I assign. I appologize if this isn’t the place to post this. I also have no clue about how this scripting etc works. Can anyone help me? Thanks so much!

  • it would be really cool to have the browser component to run with the maschine mk1 hardware so that you can go through the ableton on the maschine hardware like on push

  • I’m trying to modify the consts.py file to add some new scale types to Push. I follow the steps exactly as they are written but when I open Live none of Push’s buttons light up and it just hangs on the ‘Please Open Live to Play’ dialog.

    Help? :(

  • bonjour Julien,

    merci pour le travail de vulgarisation et de diffusion. J’aimerais effectuer des motifs mineures aux scripts du APC-40 mais les codes source que tu as mis à notre disposition ne fonctionnent pas dans mon environnement. Je suis sous Mavericks 10.9.4 et j’ai live 9.1.

    Les fichiers source .py ne semblent pas se compiler correctement car l’APC/Live ne les reconnaissent plus. C’est possible ?

    Je présume que c’est une question de ma version de Python qui n’est pas la bonne ?
    Merci encore

    • c’est Live qui compile directement les .py
      il vaut mieux procéder fichier par fichier plutôt que de tout redonner à compiler
      je ne peux pas aider plus: je n’ai pas de temps…

      • D’accord, merci !

  • Hi,
    I decompiled the BrowserComponent.pyc from Live 9.1.4 with Uncompyle2 and Push only shows me “Nothing to browse”. The Error log lists several errors especially for the “browser_model” – like update_browser_model, make_browser_model and so on. Any idea whats the problem here ?
    Downgrading Live to 9.1.3 with the supplied *.py from github doesn’t work either – only gives a blank screen.
    Any help is very welcome :)

    • no support except what I already did. sorry

  • Julian, as a long time Live user and professional python developer I have always admired your work with the remote scripts, so thank you!

    I am curious, have you ever seen a way to automate setting of Live’s application preferences? Ableton implements it’s own UI controls and so one can’t use the windows automation API or tools like AutoIT to control the allocation remotely, i.e. Without keyboard and mouse.

    Thanks, it’s developers like you that make Lives community as great and creative as it is!

  • Did anyone manged to get this to work??? So far i’m only seeing comments stating that it doesn’t and it does not work for me either.

    • what work or not ?