• Stars
    star
    467
  • Rank 93,935 (Top 2 %)
  • Language
    Python
  • Created over 11 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Query and control Ableton Live from Python

PyLive

NOTE: pylive has now been updated to to interface exclusively with AbletonOSC for Live 11 support. Legacy LiveOSC is no longer supported beyond v0.2.2.

PyLive is a framework for querying and controlling Ableton Live from a standalone Python script, mediated via Open Sound Control. It is effectively an interface to the Live Control Surfaces paradigm, 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.

Requirements

Installation

From PyPi:

pip3 install pylive

Or via 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: scan a Live set, trigger a clip,
# and modulate some device parameters.
#------------------------------------------------------------------------
import live
import random

#------------------------------------------------------------------------
# Scan the set's contents and set its tempo to 110bpm.
#------------------------------------------------------------------------
set = live.Set()
set.scan(scan_clip_names = True, scan_devices = 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()

#------------------------------------------------------------------------
# We can determine our internal timing based on Live's timeline using
# Set.wait_for_next_beat(), and trigger clips accordingly.
#------------------------------------------------------------------------
set.wait_for_next_beat()
clip.get_next_clip().play()

#------------------------------------------------------------------------
# Now let's modulate the parameters of a Device object.
#------------------------------------------------------------------------
device = track.devices[0]
parameter = random.choice(device.parameters)
parameter.value = random.uniform(parameter.minimum, parameter.maximum)

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.Set object.
  • Call set.scan(), which queries Live for an index of tracks, clip statuses, and (optionally) clip names and devices
  • Interact with Live by setting and getting properties on your Set:
    • set.tempo, set.time, set.overdub are global Set properties
    • set.tracks is a list of Track objects
    • set.tracks[N].name, set.tracks[N].mute, are Track properties
    • set.tracks[N].clips is a list of Clip objects (with empty slots containing None)
    • set.tracks[N].devices is a list of Device objects
    • set.tracks[N].devices[M].parameters is 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. Contains Device and Clip objects. May be a member of a Group.
  • Group: A grouped set of one or more Track objects.
  • Device: An instrument or audio effect residing within a Track. Contains a number of Parameter objects.
  • Parameter: An individual control parameter of a Device, 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.

More Repositories

1

python-twitter-examples

Examples of using Python for Twitter social data mining, using the python-twitter-tools framework.
Python
584
star
2

AbletonOSC

Control Ableton Live 11 via Open Sound Control (OSC)
Python
366
star
3

isobar

A Python package for creating and manipulating musical patterns, designed for use in algorithmic composition, generative music and sonification. Can be used to generate MIDI events, MIDI files, OSC messages, or custom actions.
Python
366
star
4

signalflow

A sound synthesis framework for Python, designed for clear and concise expression of musical ideas
C++
179
star
5

python-supercollider

Python client for the SuperCollider audio synthesis server
Python
60
star
6

processing-sc

A Processing library to interface with the SuperCollider synthesis engine.
Java
25
star
7

tweetarchive

A lightweight twitter archiving tool, written in Python
Python
12
star
8

xgrid-installer

Apple Xgrid installer for Mountain Lion
CSS
10
star
9

subvertle

A framework to access, translate and synthesise BBC iPlayer subtitles.
Python
6
star
10

python-blockbuffer

Buffer samples and iterate over blocks of a fixed size, with overlap
Python
6
star
11

gossip

network-based model of gossip spread
5
star
12

sc-monome

SuperCollider classes to simplify interfacing with Monome OSC controllers
SuperCollider
4
star
13

ideoforms

3
star
14

pysoso

a quiet and pythonic way to follow the web
Python
3
star
15

lumin-order

Reorder a video file by frame luminosity.
Python
3
star
16

pcr1000

A Python package to interface with the ICOM PCR-1000 serial-controlled radio receiver.
Python
3
star
17

markup-melodium

The Markup Melodium: A JavaScript framework which translates webpages into music
JavaScript
2
star
18

proxy-toggle

OS X shell script to create an ssh web proxy
Shell
2
star
19

generate-changelog-from-releases

Generate CHANGELOG.md from GitHub releases
Python
2
star
20

audio-io-manager

A minimal audio I/O interface for iOS.
Objective-C
2
star
21

signalflow-audio

Audio files for the SignalFlow DSP engine
2
star
22

python-jdp

JSON Datagram Protocol for Python
Python
1
star
23

natural-systems

Processing code demonstrations on simulating natural systems
Processing
1
star
24

phd

Simulation code from my PhD thesis
C
1
star
25

qlspectrogram

QuickLook plugin to render audio files as a spectrogram
Objective-C
1
star