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

Discuss music production with Ableton Live.
Nathan Ramella
Posts: 128
Joined: Wed Jun 06, 2007 10:48 am

Post by Nathan Ramella » Wed Jun 06, 2007 7:14 pm

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? :D

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.

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

Post by Angstrom » Wed Jun 06, 2007 7:48 pm

firstly wow, secondly holy shit!
thirdly well done,
fourthly hooray for Ableton & Bernd for not shutting this down - it can only benefit them as a company, and perhaps even personally. I can imagine Robert working on a python powered Henke-controller number 3 right now!

Bumblebeeman
Posts: 87
Joined: Mon Jun 28, 2004 11:08 am
Contact:

Post by Bumblebeeman » Wed Jun 06, 2007 7:55 pm

at the risk of sounding stupid what does it do?

should 'ordinary' live users stay way or is there anything in it for us?

noisetonepause
Posts: 4938
Joined: Sat Dec 28, 2002 3:38 pm
Location: Sticks and stones

Post by noisetonepause » Wed Jun 06, 2007 8:08 pm

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?
Don't be ordinary! Learn Python, read docs, have a hack!
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.

bigbadotis
Posts: 836
Joined: Fri May 30, 2003 10:31 pm
Location: rochester, ny
Contact:

Post by bigbadotis » Wed Jun 06, 2007 8:08 pm

crazy cool. And again props to Ableton for getting behind it. I can't wait to play around with this!

hoffman2k
Posts: 14718
Joined: Tue Jun 15, 2004 6:40 pm
Location: Belgium
Contact:

Post by hoffman2k » Wed Jun 06, 2007 8:12 pm

bigbadotis wrote:crazy cool. And again props to Ableton for getting behind it. I can't wait to play around with this!
I cant wait till you play around with it either :D
Live dashboard? :wink:

Tone Deft
Posts: 24152
Joined: Mon Oct 02, 2006 5:19 pm

Post by Tone Deft » Wed Jun 06, 2007 8:39 pm

Nathan Ramella wrote:Is that 'hello' enough for you? :D
omfg I'm speachless.
In my life
Why do I smile
At people who I'd much rather kick in the eye?
-Moz

JamesAndrew
Posts: 4
Joined: Mon Aug 28, 2006 2:08 pm

Post by JamesAndrew » Wed Jun 06, 2007 9:06 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.

kooki415
Posts: 183
Joined: Thu Apr 20, 2006 12:37 am

Post by kooki415 » Wed Jun 06, 2007 9:52 pm

well hot pants. i was waiting for osc support before i upgraded (still on live 4) but i guess thats no longer an issue. this is 100 times more awesome than what i expected to come out of the c74 deal. but maybe that means that will only be CRAZYER.


this rocks.

Sales Dude McBoob
Posts: 2842
Joined: Thu Dec 02, 2004 9:34 pm
Location: Durham, NC. USA
Contact:

Post by Sales Dude McBoob » Wed Jun 06, 2007 9:56 pm

Huh.

Telnet server?

OSC?

Huh... okay.

::Launches Sasha clip. Pumps fist in air to empty apartment::

Nathan Ramella
Posts: 128
Joined: Wed Jun 06, 2007 10:48 am

Post by Nathan Ramella » Wed Jun 06, 2007 10:00 pm

Sales Dude McBoob wrote:Huh.

Telnet server?

OSC?

Huh... okay.

::Launches Sasha clip. Pumps fist in air to empty apartment::
Can I put this on our 'success story' page? :lol:

dizzib
Posts: 20
Joined: Sat Jun 10, 2006 10:19 am

Post by dizzib » Wed Jun 06, 2007 10:18 pm

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 :-)

Nathan Ramella
Posts: 128
Joined: Wed Jun 06, 2007 10:48 am

Post by Nathan Ramella » Wed Jun 06, 2007 10:21 pm

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 :-)
Look at the code. There's midi_recieve() and midi_send() methods in there.. Although I haven't played with it at all..

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. :D

dizzib
Posts: 20
Joined: Sat Jun 10, 2006 10:19 am

Post by dizzib » Wed Jun 06, 2007 10:44 pm

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...

stjohn
Posts: 478
Joined: Tue Sep 12, 2006 2:20 am

Post by stjohn » Wed Jun 06, 2007 10:47 pm

hi all, this sounds brilliant thanks!!

ive installed pythos 2.2.3, copied it into the Midi resources, and installed a demo of absolute telnet..

im new to telnet so im unsure of how to connect to localhost 23.

any help would be greatly appreciated
thanks all

:D

Post Reply