| 1 |
""" |
| 2 |
03-looper.py - High quality crossfading multimode sound looper. |
| 3 |
|
| 4 |
The Looper object reads audio from a PyoTableObject and plays it back in |
| 5 |
a loop with user-defined pitch, start time, duration and crossfade time. |
| 6 |
|
| 7 |
Looper will send a trigger signal every time a new playback starts, which |
| 8 |
means at the object activation and at the beginning of the crossfade when |
| 9 |
looping. User can retrieve the trigger streams with obj['trig']. |
| 10 |
|
| 11 |
Looper also outputs a time stream, given the current position of the |
| 12 |
reading pointer, normalized between 0.0 and 1.0 (1.0 means the beginning |
| 13 |
of the crossfade), inside the loop. User can retrieve the trigger stream |
| 14 |
with obj['time']. |
| 15 |
|
| 16 |
Some methods let change the behaviour of the loop: |
| 17 |
|
| 18 |
- Looper.appendFadeTime(boolean): |
| 19 |
If True, the crossfade starts after the loop duration. |
| 20 |
- Looper.fadeInSeconds(boolean): |
| 21 |
If True, the crossfade duration (`xfade` attribute) is set in seconds. |
| 22 |
|
| 23 |
""" |
| 24 |
from pyo import * |
| 25 |
|
| 26 |
s = Server().boot() |
| 27 |
|
| 28 |
table = SndTable("../snds/baseballmajeur_m.aif") |
| 29 |
table.view() |
| 30 |
|
| 31 |
looper = Looper( |
| 32 |
table=table, |
| 33 |
pitch=1.0, |
| 34 |
|
| 35 |
start=0, |
| 36 |
dur=table.getDur(), |
| 37 |
xfade=25, |
| 38 |
mode=1, |
| 39 |
|
| 40 |
xfadeshape=0, |
| 41 |
|
| 42 |
startfromloop=False, |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
interp=4, |
| 47 |
|
| 48 |
autosmooth=True, |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
mul=0.5, |
| 54 |
) |
| 55 |
looper.ctrl() |
| 56 |
|
| 57 |
stlooper = looper.mix(2).out() |
| 58 |
|
| 59 |
s.gui(locals()) |