Launch Ableton scene from Javascript

    Apr 15 2014 | 10:03 am
    Can anyone please advise what call I can make in javascript to launch a scene in Ableton Live. The path using the API i believe is e.g "live_set scenes 0" and then the function to call is "fire" but I am not sure how to put this in javascript syntax and it would be very good if anyone can advise.

    • Apr 15 2014 | 1:10 pm
      Hi, try this:
      var lom_api = new LiveAPI( callback, 'path live_set scenes 0' ); 'fire' );
    • Apr 15 2014 | 6:53 pm
      Thanks for the advise but I get the following error: js: testapi.js: Javascript ReferenceError: callback is not defined, line 2
    • Apr 16 2014 | 8:03 am
      Hi, you need to supply a callback function also. in this case, it doesn't need to do anything (unless you want to start doing things when the scene is launched)
      function callback() { }
    • Apr 16 2014 | 10:11 pm
      Thanks again but I still do not get it to work.. Now I get: jsliveapi: set path: invalid path jsliveapi: call fire: no valid object set
      This is my code:
      function bang(){
      	var lom_api = new LiveAPI( callback, 'path live_set scenes 3' ); 'fire' );
      function callback() {
    • Apr 17 2014 | 8:42 am
      sorry, my bad, you don't need to 'path' in the string for js, just the 'live_set scenes 3') - get confused sometimes switching between the 2 :)
    • Apr 17 2014 | 11:56 am
      Ah thanks - it works fine now? Just a quick quick question regarding the callback. I have seen in some other examples that "this.patcher" has been used instead of "callback". Do you know the difference?
    • Apr 17 2014 | 12:52 pm
      maybe that's a way of not having to specify a callback if you're not interested in it... that would be my guess
    • Apr 17 2014 | 1:35 pm
      Looking at the docs:
      Legacy note: previous versions of the LiveAPI object required the jsthis object's this.patcher property as the first argument. For backward-compatibility, this first argument is still supported, but is no longer necessary.
      So if you don't need a callback you can omit that parameter - I've just tested this and it works, but at one point this didn't work and you needed to pass 2 parameters in (maybe something broke and is now fixed)
    • Apr 17 2014 | 6:21 pm
      Ok great:) Good to get this verified. Thanks again Lee for very good help with this post!