Who wants access to Ableton's Python API? .. You? .. Ok!

Discuss music production with Ableton Live.
queglay
Posts: 522
Joined: Wed May 03, 2006 7:15 am

Post by queglay » Mon Feb 04, 2008 10:26 pm

thanks for all the good info mdk. ill get into it after work tonight. i really know nothing about that low level stuff, but I know i'll get there somehow.

this is all very exciting stuff. the possiblities just boggle.
Load VST Presets from Push's Browser!
http://www.audiomodder.com

The Phat Conductor
Posts: 1768
Joined: Thu Apr 07, 2005 9:30 pm

Post by The Phat Conductor » Mon Feb 04, 2008 10:30 pm

any word on the mac front?
ill gates aka the phat conductor
producer, performer + ableton/music teacher

http://www.illgates.com

Clearscreen
Posts: 1743
Joined: Sun Jul 11, 2004 5:07 am
Location: Melbourne AU
Contact:

Post by Clearscreen » Mon Feb 04, 2008 11:33 pm

WOW! if you guys get this stuff working please post it up for download - i tried geting this to work ages ago but kept having similar problems to what you found, and as i have very little idea about python i eventually gave up on it...
it's strange that so many big statements were made by these guys but it didn't seem to work 'out of the box'. i almost wonder if broken code was posted for download for a reason - is it possible these guys have been co-opted by ableton to implement OSC? or is my conspiracy theory radar on the fritz again? :D

anyhoo - it's good to see someone getting somewhere with this stuff again!
Hp Elitebook 2.8Ghz. Live 7.0.14 & Live 8.1.5, XP Pro. and stuff...

queglay
Posts: 522
Joined: Wed May 03, 2006 7:15 am

Post by queglay » Mon Feb 04, 2008 11:45 pm

well im pretty sure that this stuff isn't realy being developed anymore, and the mac front is probably a no go unless someone wants to get into it.

when im confident I've fixed the basic functionality ill share my progress.
Load VST Presets from Push's Browser!
http://www.audiomodder.com

Clearscreen
Posts: 1743
Joined: Sun Jul 11, 2004 5:07 am
Location: Melbourne AU
Contact:

Post by Clearscreen » Tue Feb 05, 2008 12:01 am

queglay wrote:well im pretty sure that this stuff isn't realy being developed anymore, and the mac front is probably a no go unless someone wants to get into it.

when im confident I've fixed the basic functionality ill share my progress.
thanks in advance :D
Hp Elitebook 2.8Ghz. Live 7.0.14 & Live 8.1.5, XP Pro. and stuff...

queglay
Posts: 522
Joined: Wed May 03, 2006 7:15 am

Post by queglay » Tue Feb 05, 2008 4:28 am

mdk wrote:right, well from a quick look there is a bug in LiveOSCCallbacks.py for requesting a clip name, but it shouldnt stop it sending strings.

on line 258 my version says this :

self.oscServer.sendOSC("/live/name/scene", (trackNumber, clipNumber, LiveUtils.getClip(trackNumber, clipNumber).name))

but should be

self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, LiveUtils.getClip(trackNumber, clipNumber).name))
your file must be a little out of date maybe. mine says

self.oscServer.sendOSC("/live/name/clip", (trackNumber, clipNumber, clipSlot.clip.name))


now i tried pickle, to dump the clip names to a file to see what the format is-

pickle.dump(clipSlot.clip.name, debuginfo)

i get this garble-

Vsick2
p0
.V1 1-Audio
p0
.


which is only the first 2 clips in track 1. they are called sick2, and 1 1-audio
i dont know what all that other info is.

it seems to stop as soon as it hits an empty clipslot. i should be able to get around that problem, however, i have to figure out how to send those strings via osc properly too.

is there any way to print errors back out to the python shell instead of a text file? even with a text file i can't get definitions of the errors, only output variables and strings.
Load VST Presets from Push's Browser!
http://www.audiomodder.com

queglay
Posts: 522
Joined: Wed May 03, 2006 7:15 am

Post by queglay » Tue Feb 05, 2008 6:59 am

well i managed to convert it to a string using str(), and the string succesfully goes out via osc.

however, it gets to a point where there is an empty value. looking at the pickle output you can see again here-

Vsick2
p0
.Vclipb
p0
.Vblah
p0
.
it gets a 3 variables successfully. at the fourth one (which is supposed to be a blank slot) instead of continuing the loop just ceases.

i tried the following to check the variable -

Code: Select all
if clipSlot.clip.name:
outstring = str(clipSlot.clip.name)
else:
outstring = "empty"
pickle.dump(outstring, debuginfo)

but it didn't seem to work and the loop still gets broken.
Load VST Presets from Push's Browser!
http://www.audiomodder.com

queglay
Posts: 522
Joined: Wed May 03, 2006 7:15 am

Post by queglay » Tue Feb 05, 2008 8:19 am

well its working!

I can now get all clip slot names through to max msp via osc. empty clip slots are returned as "empty", so it shouldn't be too hard for people to get going and create representations of what clips are filled in live.

im using live 6.0.10. Haven't tried live 7, but i heard that it was ok.

some of the osc functions that were originally in there dont work because any text variable sent out needs to be converted to a string using the str() method.

im sure if you delve into more functionality then just getting clip and scene names you will have to do some more python debugging.

I'm not really going to be able to help out too much on this one once its up. to be honest its probably going to be a nightmare to get working, but I've tried to keep the documentation as simple as pissible.

just be warned, its not for the faint hearted!

I'm trying to get a hold of nathan to see if i can upload my modified files in place of the ones alread on the google forum.
Load VST Presets from Push's Browser!
http://www.audiomodder.com

julienb
Posts: 1843
Joined: Sat Oct 29, 2005 1:15 pm
Location: France
Contact:

Post by julienb » Tue Feb 05, 2008 2:13 pm

Hello everybody..
it seems to work on my 7.0.1

just several problems yet..


BUT, I would like to know if python is the way to send "position in a clip" to another app (max for example)

by "position in a clip", I mean : I'd like to have a feedback from live when the clip will finish... like the blinking arrows on the live set ; just before the clip finishes, a message/data is sent to max

Is Python the way to do that??
Julien Bayle
Art + Teaching/Consulting

Ableton Certified Trainer
Max Certified Trainer


Structure Void / Ableton Certified Training Center

mdk
Posts: 914
Joined: Sun Jul 31, 2005 3:51 pm
Location: Skopje, Macedonia
Contact:

Post by mdk » Tue Feb 05, 2008 2:40 pm

i dont think you cant do that directly because the API only exposes 'is_playing' and 'is_triggered'. So you could get an event when it actually starts and stops, but not somewhere inbetween.

BUT

You also have access to the length of a clip and its loop settings so if you know

A: when it starts
B: its length
C: the tempo

you can calculate when it will finish.

sounds like fun :D
Pr0k Records - Bandcamp Facebook Twitter

julienb
Posts: 1843
Joined: Sat Oct 29, 2005 1:15 pm
Location: France
Contact:

Post by julienb » Tue Feb 05, 2008 2:48 pm

great ...!

I have some problem.
with LiveTelnet, I tried the "say hello" tips ... in order to test the link between Live & outside world and I get that :
Welcome to the Ableton Live Python Interpreter (Python 2.2.1)
Brought to by LiveAPI.org
>>> doc=Live.Application().get_application().get_document()
>>> doc.tempo = 80
Traceback (most recent call last):
File "<console>", line 1, in ?
NameError: name 'doc' is not defined
any ideas?
I already did the modification written on http://code.google.com/p/liveapi/issues/detail?id=1
another path problem?
Julien Bayle
Art + Teaching/Consulting

Ableton Certified Trainer
Max Certified Trainer


Structure Void / Ableton Certified Training Center

mdk
Posts: 914
Joined: Sun Jul 31, 2005 3:51 pm
Location: Skopje, Macedonia
Contact:

Post by mdk » Tue Feb 05, 2008 2:53 pm

oh there's another thing i just thought of, the message pump only runs every 100ms. (the update_display handler)

You can add a listener for the current_song_time and that gets you updates every 60ms, which is a slight improvement.

So we had an idea and built a small proof-of-concept prototype which seemed to work.

If you send in midi events to the device associated with the remote script you can use those to trigger your processing. So nate built a small app in synthmaker to pump out midi cc's at any frequency we wanted, this was then connected to a Midi Yoke virtual port which was connected in live to that remote script.

Then in the script I did this :

Code: Select all

   # when midi is received, see if its a CC message
    def receive_midi(self, midi_bytes):
        if ((midi_bytes[0] & 240) == CC_STATUS):
            channel = (midi_bytes[0] & 15)
            cc_no = midi_bytes[1]
            cc_value = midi_bytes[2]
            self.handle_midi_cc(cc_no,cc_value)

   # use a midi CC to process the incoming command buffer
    def handle_midi_cc(self,cc_no,cc_value):     
        if self.clientConnection:
            self.processBuffer()
so, you could do something with max to pump out midi cc's to a virtual midi port which triggers the remote script handler and get updates when you want.

like i said, it seemed to work but i didnt have much time to work with it to see what the actual rate was, but you would expect it to be able to run pretty accurately as its part of the midi handling thread which runs at a much higher resolution than the display handler.
Pr0k Records - Bandcamp Facebook Twitter

julienb
Posts: 1843
Joined: Sat Oct 29, 2005 1:15 pm
Location: France
Contact:

Post by julienb » Tue Feb 05, 2008 3:33 pm

I created another post about "clip playing information w/ Live & Max/MSP" : http://www.ableton.com/forum/viewtopic. ... 918#632918

I'd like to report the blinking state of the arrow (=the playing state of the clip) on the monome...

if you have any ideas, go there http://www.ableton.com/forum/viewtopic. ... 918#632918
I didn't want to polluate this thread with that ;-)
Julien Bayle
Art + Teaching/Consulting

Ableton Certified Trainer
Max Certified Trainer


Structure Void / Ableton Certified Training Center

morerecords

Post by morerecords » Tue Feb 05, 2008 4:37 pm

I truly apologize for a naive question, while I am a musician, I am not a computer guy, I have read these threads, I have a good idea of what is being discussed, but could someone break it down for a guy? WHat exactly is Pynthon/API and what applications could be applied using OSC?
It seems it is similar in concept to MIDI, but modernized and with more effiiency.

Angstrom
Posts: 14987
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

Post by Angstrom » Tue Feb 05, 2008 5:29 pm

there's a number of things you can do, but it's not really ready for prime-time. Most of us dabblers are experimenting with stuff that is not supported.

That said - you can get and set most of the properties that a Live set holds.
That means you could make a display in a 3rd party application (such as Flash) which only showed the information you need ... and big!
So a laptop screen might show the names of the current clips playing and what position they are at - and nothing more!

Another option -
You could get the length of the first recorded clip, do a little calculation to find out how that relates to the current set BPM and make the set be at the BPM of that first clip

If you have a device that uses OSC you could get a much better tie-in with Live (EG - a Lemur)

but for now just consider it wild experimentation by nosy tech types. If Ableton ever do release a method of interacting via OSC, or creating your own interfaces - it's unlikely to rely on installing an old version of Python and more likely to be a bit more user friendly :)

Post Reply