PyLive
PyLive 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 time
- query and modify properties of tracks, clips, scenes and devices
- trigger and stop clips and scenes
It can perform many of the operations described in the AbletonOSC 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 a virtual MIDI bus and using isobar to generate MIDI sequences.
Note for legacy users: As of 2023, pylive has been updated to to interface exclusively with AbletonOSC for Live 11 support. Legacy LiveOSC is no longer supported beyond v0.2.2.
Requirements
Installation
From PyPi:
pip3 install pylive
Or to install the latest (pre-release) code from git:
git clone https://github.com/ideoforms/pylive.git
cd pylive
python3 setup.py install
To check that pylive is communicating successfully with Ableton Live, try running one of the examples, or run the test suite with:
python3 setup.py test
Usage
#------------------------------------------------------------------------
# Basic example of pylive usage: connect to the Live set, trigger a clip,
# and modulate some device parameters.
#------------------------------------------------------------------------
import live
import random
#------------------------------------------------------------------------
# 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 %d beats" % (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 %s of device %s" % (parameter, device))
Overview
To 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 a
live.Setobject, passingscan=Trueto automatically index the tracks, clips and devices within the set - Interact with Live by setting and getting properties on your
Set: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 objects
Getters and setters use Python's @property idiom, meaning that accessing set.tempo will query or update your Live set.
If you know that no other processes will interact with Live, set set.caching = True to cache properties such as tempo. This will query the Live set on the first instance, and subsequently return locally-stored values.
For further help, see pydoc live.
Classes
Set: 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.
Limitations
Note that pylive is not intended for sending MIDI note events or control messages to a set. For MIDI controls, use a separate module such as mido.
Metadata
Release files for pylive 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pylive-0.4.0.tar.gz | 22.6 kB | Without provenance | Details |
Release files / pylive-0.4.0.tar.gz
| Download URL | pylive-0.4.0.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0b38860dd1df276f923cfd132e80c1e38ff666b186c2510cca32f475a14a631b
|
|
BLAKE2b-256 checksum How to use checksums |
48243b129f1e09e8bd6f2726237ae3dd743743870f9de727ef0bd67f47ae8116
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.12.0
|
Security for pylive 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.