Last active
September 27, 2016 12:55
-
-
Save hems/8a274e3dc58880a3557434de361dfabf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------------------------------------------------------------------------ | |
# Basic random test based on some example from | |
# https://github.com/ideoforms/pylive | |
# | |
# Every beat randomly pick a parameter from device[0] from track[0] | |
# and randomize it's value | |
#------------------------------------------------------------------------ | |
import live, random | |
#------------------------------------------------------------------------ | |
# Scan the set's contents and set its tempo to 110bpm. | |
#------------------------------------------------------------------------ | |
set = live.Set() | |
# we probably don't need this line here. | |
# anyway it's fun to have it. | |
set.scan(scan_clip_names = True, scan_devices = True) | |
#------------------------------------------------------------------------ | |
# Each Set contains a list of Track objects. | |
#------------------------------------------------------------------------ | |
track = set.tracks[0] | |
print "track name %s" % track.name | |
clip = track.clips[0] | |
print "clip name %s, length %d beats" % (clip.name, clip.length) | |
#------------------------------------------------------------------------ | |
# Now let's modulate the parameters of a Device object. | |
#------------------------------------------------------------------------ | |
device = track.devices[0] | |
print "device -> %s" % device.name | |
while True: | |
parameter = random.choice(device.parameters) | |
value = random.uniform(parameter.minimum, parameter.maximum) | |
parameter.value = value | |
print "setting %s to: %.4f" % ( parameter.name, value ) | |
set.wait_for_next_beat() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment