Giter Site home page Giter Site logo

pylive's Introduction

PyLive

Introduction

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: querying and modifying properties of tracks, clips and devices.

Requirements

Usage

#------------------------------------------------------------------------
# Basic example of pylive usage: scan a Live set, trigger a clip,
# and modulate some device parameters.
#------------------------------------------------------------------------

import live, 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 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 Parameters.
  • Parameter: An individual control parameter of a Device, with a fixed range and variable value.

pylive's People

Contributors

ideoforms avatar howthebodyworks avatar

Watchers

Bruno Afonso avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.