Package: pylive
PyLivePyLive is a framework for querying and controlling Ableton Live from a standalone Python script, mediated via Open Sound Control. Internally, it uses the same API as a Live Control Surface, which means it can do anything that a hardware control surface can do, including:query and modify global parameters such as tempo, volume, pan, quantize, arrangement timequery and modify properties of tracks, clips, scenes and devicestrigger and stop clips and scenesIt can perform many of the operations described in theAbletonOSC API. More comprehensive feature coverage is a work-in-progress.If you are looking simply to send MIDI messages to Live, this module is not what you want. Instead, try setting up avirtual MIDI busand usingisobarto generate MIDI sequences.Note for legacy users:As of 2023, pylive has been updated to to interface exclusively withAbletonOSCfor Live 11 support. Legacy LiveOSC is no longer supported beyondv0.2.2.RequirementsAbleton Live 11+Python 3.7+AbletonOSCInstallationFrom PyPi:pip3 install pyliveOr to install the latest (pre-release) code from git:git clone https://github.com/ideoforms/pylive.git
cd pylive
python3 setup.py installTo check that pylive is communicating successfully with Ableton Live, try running one of theexamples, or run the test suite with:python3 setup.py testUsage#------------------------------------------------------------------------# Basic example of pylive usage: connect to the Live set, trigger a clip,# and modulate some device parameters.#------------------------------------------------------------------------importliveimportrandom#------------------------------------------------------------------------# Query the set's contents, and set its tempo to 110bpm.#------------------------------------------------------------------------set=live.Set(scan=True)set.tempo=110.0#------------------------------------------------------------------------# Each Set contains a list of Track objects.#------------------------------------------------------------------------track=set.tracks[0]print("Track name '%s'"%track.name)#------------------------------------------------------------------------# Each Track contains a list of Clip objects.#------------------------------------------------------------------------clip=track.clips[0]print("Clip name '%s', length%dbeats"%(clip.name,clip.length))clip.play()#------------------------------------------------------------------------# Mdulate the parameters of a Device object.#------------------------------------------------------------------------device=track.devices[0]parameter=random.choice(device.parameters)parameter.value=random.uniform(parameter.min,parameter.max)print("Randomising parameter%sof device%s"%(parameter,device))OverviewTo begin interacting with an Ableton Live set, the typical workflow is as follows. Live should normally be running on localhost, with LiveOSC enabled as a Control Surface.Create alive.Setobject, passingscan=Trueto automatically index the tracks, clips and devices within the setInteract with Live by setting and getting properties on yourSet:set.tempo,set.time,set.overdubare global Set propertiesset.tracksis a list of Track objectsset.tracks[N].name,set.tracks[N].mute, are Track propertiesset.tracks[N].clipsis a list of Clip objects (with empty slots containingNone)set.tracks[N].devicesis a list of Device objectsset.tracks[N].devices[M].parametersis a list of Parameter objectsGetters and setters use Python's@propertyidiom, meaning that accessingset.tempowill query or update your Live set.If you know that no other processes will interact with Live, setset.caching = Trueto cache properties such as tempo. This will query the Live set on the first instance, and subsequently return locally-stored values.For further help, seepydoc live.ClassesSet: Represents a single Ableton Live set in its entirety.Track: A single Live track object. ContainsDeviceandClipobjects. May be a member of aGroup.Group: A grouped set of one or moreTrackobjects.Device: An instrument or audio effect residing within aTrack. Contains a number ofParameterobjects.Parameter: An individual control parameter of aDevice, with a fixed range and variable value.LimitationsNote that pylive is not intended for sending MIDI note events or control messages to a set. For MIDI controls, use a separate module such asmido.