2

I'm programming a controller for use with Ableton Live 8 using the Python-based API. In my code I use a method provided in the API to watch for changes in a property's value, and call a function whenever the value changes. My goal is to change the color of the clip when the value change is noticed.

I have my code completed, and it compiles without error. From Ableton's log:

742234 ms. RemoteScriptError: RuntimeError
742234 ms. RemoteScriptError: : 
742234 ms. RemoteScriptError: Changes cannot be triggered by notifications
742234 ms. RemoteScriptError: 

It appears this is the result of using the built-in notification system to make a change to the live set during notification. Triggering the actual change AFTER the listening function has finished executing should work. Is this possible using Python?

Edit for clarification:

currently we have

  1. value change noticed, function called
  2. function attempts to change the clips color (results in error)

we need

  1. listener notices value change, function called
  2. function finds the new color value
  3. function execution ends
  4. another function is called outside the listener's scope, and changes the clips color
Conduit
  • 2,675
  • 1
  • 26
  • 39
  • I don't know anything about Abelton Live, but I'd guess that if notifications can't do modifications, there'd be some API to allow you to queue up something to happen later (once the notification has ended). I can't find documentation of the API anywhere, so I can't be any more specific. – Blckknght Feb 28 '13 at 00:43
  • It's possible to do this with functions from the Max For Live API, but I'm trying to work outside of that. I think I'd need to create my own listener, and watch for changes to a global variable. – Conduit Feb 28 '13 at 00:47

2 Answers2

1

I did a lot in M4L and know this error by heart :) I'm afraid you can't do anything about that - to my noob eyes it looks like a built-in security mechanism so you can't loop (Something changed? Change it! Something changed...).

In M4L i used Javascript Tasks to separate the steps (Tasks forget nearly everything), something like

Observer -> Something changed

Create a Task that reacts

task.execute() or task.schedule(time)

Maybe the python threading module can achieve something similar? BTW, if you happen to understand anything about the _Framework-Tasks, let me know.

  • Doubt I can hook into Javascript without M4L, which kinda defeats the purpose of building this in Python. Bummer. I'm guessing you're right about the 'security mechanism'. It looks like AL has trouble with listeners making changes to certain parts of the Live module. From (very) brief examination it looks like it might be related to the contents of files used to save the set, though that doesn't make a lot of sense to me... – Conduit Apr 29 '13 at 15:38
0

I was having the same issue trying to delete a track from a clip stop listener, then I found this thread and followed @user2323980 suggestion.
There seems to be a "_tasks" object on every Framework class (I found it throught log_message inside ClipSlotComponent and ControlSurface) that handles concurrency between tasks. And it's really simple to use it:

self._tasks.add(Task.run(func, args))

I found some uses of it on Push and MK2 scripts, those are good references.

Hugo Aboud
  • 443
  • 3
  • 10