Who wants access to Ableton's Python API? .. You? .. Ok!
I just did some livetelnet hacking and testing... incredibly cool.
Some questions regarding devices:
- Can I reach a parameter of a midi device inside a midi rack in a live set and change this state? For example, if I'd like to change the Out Hi parameter of a Velocity device in a MIDI Rack, can I do this?
- Can I also retrieve this parameter and add a listener to it, so it can be sent out by osc?
If this is possible I think I'll be able to port my ableton live / monome step sequencer (livestep48) from max/msp to python and add some really nice functionality.
See
http://forum.monome.org/topic/919
and
http://www.hornquist.se/monome
for more info.
This is currently a max/msp and ableton live 6 combo.
Some questions regarding devices:
- Can I reach a parameter of a midi device inside a midi rack in a live set and change this state? For example, if I'd like to change the Out Hi parameter of a Velocity device in a MIDI Rack, can I do this?
- Can I also retrieve this parameter and add a listener to it, so it can be sent out by osc?
If this is possible I think I'll be able to port my ableton live / monome step sequencer (livestep48) from max/msp to python and add some really nice functionality.
See
http://forum.monome.org/topic/919
and
http://www.hornquist.se/monome
for more info.
This is currently a max/msp and ableton live 6 combo.
-
Nathan Ramella
- Posts: 128
- Joined: Wed Jun 06, 2007 10:48 am
I believe so.jah wrote: Some questions regarding devices:
- Can I reach a parameter of a midi device inside a midi rack in a live set and change this state? For example, if I'd like to change the Out Hi parameter of a Velocity device in a MIDI Rack, can I do this?
Absolutely.jah wrote: - Can I also retrieve this parameter and add a listener to it, so it can be sent out by osc?
I cannot wait to see this!jah wrote: If this is possible I think I'll be able to port my ableton live / monome step sequencer (livestep48) from max/msp to python and add some really nice functionality.
remix.net - versus / liveapi / hangthedj / ammobox
LET THE GAMES BEGIN !!!
You guys are rocking our worlds right now !!!
The USERS here are the reason live is where it's at...
You guys are helping us get What we need....ableton support or not!!!
I guess this is the compensation for last week's Forum mayhem...
really... I just want to thank you again...
You guys are rocking our worlds right now !!!
The USERS here are the reason live is where it's at...
You guys are helping us get What we need....ableton support or not!!!
I guess this is the compensation for last week's Forum mayhem...
really... I just want to thank you again...
hmm, I'm an idiot somehow.Nathan Ramella wrote: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.
I can't even get Hello world to function!
here's what happens
Code: Select all
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 clues where I am going wrong?
-
Nathan Ramella
- Posts: 128
- Joined: Wed Jun 06, 2007 10:48 am
My mistake, correct command is..Angstrom wrote:
here's what happens
Code: Select all
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 clues where I am going wrong?
doc=Live.Application().get_application().get_document()
I updated my original 'hello world' post as well. Thanks for bringing this to my attention!
remix.net - versus / liveapi / hangthedj / ammobox
hmm,
sadly not much closer with that.
I've allowed Live and Telnet on my firewall BTW
sadly not much closer with that.
Code: Select all
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
>>>
...
I noticed this whole thing just now.
This is beautiful.
It's one of those rare moments when a piece of news hits you at 4 am and immediately space invaders start playing pong inside your head.
I really, really hope (and kind of expect) that the Ableton bunch will see the huge implications, and that they'll keep this door open in all the future versions as well. Live is just the right application for this kind of low-level customization.
Thank you!
Ok, a little furter investigation.
the functions defined in LiveUtils work fine, EG:
I just renamed track 2 to 'a test', and all the other functions defined in there work great.
But if I take something out of there and try and address the API with my own monkey fingers, like this.
I get that error there.
any ideas why the same code would work from the API function set, but not from my CMD window?
the functions defined in LiveUtils work fine, EG:
Code: Select all
>>> trackName(1,"a test")
u'a test'
>>>
But if I take something out of there and try and address the API with my own monkey fingers, like this.
Code: Select all
Live.Application.get_appliction().get_document().tracks[1].name="monkey_fingers"
Traceback (most recent call last):
File "<console>", line 1, in ?
AttributeError: 'module' object has no attribute 'get_appliction'
>>>
any ideas why the same code would work from the API function set, but not from my CMD window?
TYPO 'get_appliction'Angstrom wrote:Ok, a little furter investigation.
the functions defined in LiveUtils work fine, EG:
I just renamed track 2 to 'a test', and all the other functions defined in there work great.Code: Select all
>>> trackName(1,"a test") u'a test' >>>
But if I take something out of there and try and address the API with my own monkey fingers, like this.
I get that error there.Code: Select all
Live.Application.get_appliction().get_document().tracks[1].name="monkey_fingers" Traceback (most recent call last): File "<console>", line 1, in ? AttributeError: 'module' object has no attribute 'get_appliction' >>>
any ideas why the same code would work from the API function set, but not from my CMD window?
thanks,
monkey fingers and tired brain. I managed to get my own longhand calls to work now.
I've been fiddling with the functions included though.
It's great, too good to go to bed.
I know it's stupid but typing " launchClip(0,1) "
and hearing a beat start just makes me happy. Not because I like it the hard way , but because I am within touching distance of the old "set the master tempo from th efirst thing you record" holy grail
that's actually 8 seconds, because that particular clip is 4 bars of 120 bpm
(8/4)*60 = 120
so I think to set the master tempo off the first thing you record... whatever length it may be
doc.tempo = ((clip.length/2)/4)*60
or something like that. (assuming you have assigned doc to be the Live document)

right, bed
monkey fingers and tired brain. I managed to get my own longhand calls to work now.
I've been fiddling with the functions included though.
It's great, too good to go to bed.
I know it's stupid but typing " launchClip(0,1) "
and hearing a beat start just makes me happy. Not because I like it the hard way , but because I am within touching distance of the old "set the master tempo from th efirst thing you record" holy grail
Code: Select all
>>> clip=getClip(0,1)
>>> print clip.length
16.0
(8/4)*60 = 120
so I think to set the master tempo off the first thing you record... whatever length it may be
doc.tempo = ((clip.length/2)/4)*60
or something like that. (assuming you have assigned doc to be the Live document)
right, bed
-
noisetonepause
- Posts: 4938
- Joined: Sat Dec 28, 2002 3:38 pm
- Location: Sticks and stones
Re: Scary cool!
You can easily write GUI apps in Python... There'll even be a PythonCocoa bridge in next version of OS X so you can easily write native OS X apps in Python (yet another reason to learn it!). It's obviously not as easy as Max, but I was big on Reaktor for a while, and besides the crashes and the non-workingness of it, what put me off was the dragging of wires. It seems like a good idea at first, but then you have to patch up 8 16 output objects to corresponding input objects, or whatever. 100+ wires, just to see how one thing works... and two minutes later you realise that you actually need to insert a Log module or multiply by 10 or whatever. You delete your 8*16 wires, insert 8*16 objects (well, you insert 16 and the copy/paste 7 times - still tedious!), and draw 8*16*2 new ones... trust me, at some point you'll wish you were working with CSound!Tone Deft wrote:MAX vs. Python
- Python is free, no need to buy MAX
- Which is ultimately easier to program in? I'm leaning towards MAX, but I'm a n00b at both.
- MAX has visual tools (buttons, GUIs)
- Python has more latency, but that be worked on and for controls 60mS is fine.
- can't think, I'm in shock...
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.
Can you help me a bit. Download this example .ALS project:Nathan Ramella wrote:I believe so.jah wrote: Some questions regarding devices:
- Can I reach a parameter of a midi device inside a midi rack in a live set and change this state? For example, if I'd like to change the Out Hi parameter of a Velocity device in a MIDI Rack, can I do this?
http://www.hornquist.se/monome/midieffe ... locity.als
Open the project - that's simply a velocity effect within a midi effect rack in a midi track. Now, I'd like to reach the velocity device. In livetelnet I tried this (to retrieve the name of the velocity device):
>>> track = getTrack(0)
>>> track.devices[0].name
u'MIDI Effect Rack'
>>> track.devices[0].devices[0].name
Traceback (most recent call last):
File "<console>", line 1, in ?
AttributeError: 'Device' object has no attribute 'devices'
>>>
Didn't work that way.. It found the midi effect rack but not the velocity device. Is it impossible to reach devices which are contained within other devices (that is, they reside inside racks of some kind, like this velocity device)?
Thanks for the help.
Sounds brilliant!Nathan Ramella wrote:Absolutely.jah wrote: - Can I also retrieve this parameter and add a listener to it, so it can be sent out by osc?
I hope I can get it to work. I already have a version of this running with max/msp and live!Nathan Ramella wrote:I cannot wait to see this!jah wrote: If this is possible I think I'll be able to port my ableton live / monome step sequencer (livestep48) from max/msp to python and add some really nice functionality.
Kind regards
-
Nathan Ramella
- Posts: 128
- Joined: Wed Jun 06, 2007 10:48 am
Ok. So as far as devices contained inside racks, I don't think you can 'reach inside' the rack, however if you've assigned a macro value to one of the inside values, then you can poke things internal to the rack. At least thats what I'm currently seeing. Not ideal, yeah.. But. It's life. Basically as long as you map a macro to the setting you want to change you can then poke it like so:jah wrote:
Can you help me a bit. Download this example .ALS project:
http://www.hornquist.se/monome/midieffe ... locity.als
Open the project - that's simply a velocity effect within a midi effect rack in a midi track. Now, I'd like to reach the velocity device. In livetelnet I tried this (to retrieve the name of the velocity device):
Code: Select all
doc=Live.Application().get_application().get_document()
t=doc.tracks[0]
device=t.devices[0]
>>> for param in device.parameters: print param.name
...
Device On
Macro 1
Macro 2
Macro 3
Macro 4
Macro 5
Macro 6
Macro 7
Macro 8
Chain Selector
>>> for param in device.parameters: print param
...
on
0
0
0
52 <-- I mapped that to velocity drive, you could now set it by manipulating the 5th param device in the list
0
0
0
0
0
remix.net - versus / liveapi / hangthedj / ammobox