Who wants access to Ableton's Python API? .. You? .. Ok!
-
- Posts: 128
- Joined: Wed Jun 06, 2007 10:48 am
Here's a really simple example of how to use the API. Install LiveTelnet, load up a project, select 'LiveTelnet' from the remote surfaces menu.
Telnet to localhost, you will be greeted with the LiveTelnet banner.. Then type in the following commands:
doc=Live.Application().get_application().get_document()
'doc' is now an object that contains all the information about your song, all the tracks, clips, etc.. There's a lot of nesting in the objects but for a really simple example..
Type:
doc.tempo = 80
You've just set your project tempo to 80.
Is that 'hello' enough for you?
It's really easy to manipulate and make changes, check out 'LiveUtils.py' for a bunch of functions that wrap API functionality..
Telnet to localhost, you will be greeted with the LiveTelnet banner.. Then type in the following commands:
doc=Live.Application().get_application().get_document()
'doc' is now an object that contains all the information about your song, all the tracks, clips, etc.. There's a lot of nesting in the objects but for a really simple example..
Type:
doc.tempo = 80
You've just set your project tempo to 80.
Is that 'hello' enough for you?
It's really easy to manipulate and make changes, check out 'LiveUtils.py' for a bunch of functions that wrap API functionality..
Last edited by Nathan Ramella on Sat Jun 09, 2007 1:02 am, edited 1 time in total.
-
- Posts: 87
- Joined: Mon Jun 28, 2004 11:08 am
- Contact:
-
- Posts: 4938
- Joined: Sat Dec 28, 2002 3:38 pm
- Location: Sticks and stones
Don't be ordinary! Learn Python, read docs, have a hack!Bumblebeeman wrote:at the risk of sounding stupid what does it do?
should 'ordinary' live users stay way or is there anything in it for us?
Suit #1: I mean, have you got any insight as to why a bright boy like this would jeopardize the lives of millions?
Suit #2: No, sir, he says he does this sort of thing for fun.
Suit #2: No, sir, he says he does this sort of thing for fun.
-
- Posts: 836
- Joined: Fri May 30, 2003 10:31 pm
- Location: rochester, ny
- Contact:
-
- Posts: 4
- Joined: Mon Aug 28, 2006 2:08 pm
Here's one to impress your friends. Ever notice that you can rename all the tracks in Live except the "Master"? Not anymore.
When I was first poking around at the internal API shortly after Rob had figured out how to inject code via the remote scripts so Nathan could extend his original 'hack' so that we could actually get Live up and running while maintaining our control window, I wanted to do something - anything - that couldn't be done through the Live UI or via MIDI. This is what I did :
sys.modules['Live'].Application.getApplication().getDocument().master_track.name = '0wned'
Let me tell you, it was intense to see the track name change as I hit enter! Sure, its not that "useful" per se, but that wasn't the point. We were in. We were in further than anyone outside of Ableton up to this point.
Now with the LiveUtils included in the distro its simpler. Launch Live and select the LiveTelnet script. telnet to localhost and type :
getSong().master_track.name = 'TheMaster'
voila, you have a custom-named master track.
When I was first poking around at the internal API shortly after Rob had figured out how to inject code via the remote scripts so Nathan could extend his original 'hack' so that we could actually get Live up and running while maintaining our control window, I wanted to do something - anything - that couldn't be done through the Live UI or via MIDI. This is what I did :
sys.modules['Live'].Application.getApplication().getDocument().master_track.name = '0wned'
Let me tell you, it was intense to see the track name change as I hit enter! Sure, its not that "useful" per se, but that wasn't the point. We were in. We were in further than anyone outside of Ableton up to this point.
Now with the LiveUtils included in the distro its simpler. Launch Live and select the LiveTelnet script. telnet to localhost and type :
getSong().master_track.name = 'TheMaster'
voila, you have a custom-named master track.
-
- Posts: 2842
- Joined: Thu Dec 02, 2004 9:34 pm
- Location: Durham, NC. USA
- Contact:
-
- Posts: 128
- Joined: Wed Jun 06, 2007 10:48 am
Well I've managed to telnet in and change midi clip attributes. Now if I could only get at the midi notes themselves, say Notes-->Note classes with an associated listener, I'd be able to hook it up to a Monome controller and have a hands-on step sequencer completly integrated with live! I think this will be very cool
-
- Posts: 128
- Joined: Wed Jun 06, 2007 10:48 am
Look at the code. There's midi_recieve() and midi_send() methods in there.. Although I haven't played with it at all..dizzib wrote:Well I've managed to telnet in and change midi clip attributes. Now if I could only get at the midi notes themselves, say Notes-->Note classes with an associated listener, I'd be able to hook it up to a Monome controller and have a hands-on step sequencer completly integrated with live! I think this will be very cool
I should also note, anyone who wants to can send the LiveAPI.org project physical MIDI devices and we'll be happy write custom scripts for you.
Hi Nathan,
I can't seem to find midi_* functions you mention... please could you point me in the right direction?
For complete integration I'd need to be able to read all midi info from a clip as soon as the user maniuplates a clip in Live. This is so the monome always displays what is shown on the screen even when playback is stopped.
Unfortunately I don't actually own a monome but it's fun to speculate...
I can't seem to find midi_* functions you mention... please could you point me in the right direction?
For complete integration I'd need to be able to read all midi info from a clip as soon as the user maniuplates a clip in Live. This is so the monome always displays what is shown on the screen even when playback is stopped.
Unfortunately I don't actually own a monome but it's fun to speculate...