| 1 |
""" |
| 2 |
07-moving-points.py - Periodically rewrite a break-point function table. |
| 3 |
|
| 4 |
This example shows how we can dynamically modify a function table to create a |
| 5 |
curve that varies over time. |
| 6 |
|
| 7 |
Note: Rewriting a large table can produce xruns in the audio output. Usually, |
| 8 |
for this kind of processes, we want to keep the table size relatively small. |
| 9 |
|
| 10 |
""" |
| 11 |
from pyo import * |
| 12 |
|
| 13 |
s = Server().boot() |
| 14 |
|
| 15 |
|
| 16 |
table = LinTable([(0, 0), (255, 0)], size=256) |
| 17 |
table.view() |
| 18 |
|
| 19 |
|
| 20 |
lfo1 = Sine(0.1, phase=0.75, mul=0.5, add=0.5) |
| 21 |
lfo2 = Sine(0.15, phase=0.75, mul=0.5, add=0.5) |
| 22 |
|
| 23 |
|
| 24 |
def create_line(): |
| 25 |
"Function to create a new line." |
| 26 |
lst = [(0, 0)] |
| 27 |
lst.append((8, lfo1.get())) |
| 28 |
lst.append((128, lfo2.get())) |
| 29 |
lst.append((255, 0)) |
| 30 |
|
| 31 |
|
| 32 |
table.replace(lst) |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
pat = Pattern(function=create_line, time=0.05).play() |
| 37 |
|
| 38 |
|
| 39 |
amp = Osc(table, freq=4, mul=0.4) |
| 40 |
synth = RCOsc(freq=[99.5, 100], sharp=0.3, mul=amp).out() |
| 41 |
|
| 42 |
s.gui(locals()) |