| 1 |
//----------------------------------------------------------------------------- |
| 2 |
// name: LiSa-simplelooping.ck |
| 3 |
// desc: Live sampling utilities for ChucK |
| 4 |
// |
| 5 |
// author: Dan Trueman, 2007 |
| 6 |
// |
| 7 |
// Another simple example of LiSa, demonstrating dopey looping... |
| 8 |
//----------------------------------------------------------------------------- |
| 9 |
|
| 10 |
// signal chain; record a sine wave, play it back |
| 11 |
SinOsc s => LiSa loopme => dac; |
| 12 |
// set frequency |
| 13 |
440. => s.freq; |
| 14 |
// set gain |
| 15 |
0.25 => s.gain; |
| 16 |
|
| 17 |
// alloc memory |
| 18 |
1::second => loopme.duration; |
| 19 |
// ramp time of 200 ms |
| 20 |
loopme.recRamp( 200::ms ); |
| 21 |
|
| 22 |
// start recording input |
| 23 |
loopme.record(1); |
| 24 |
// 1 second later |
| 25 |
1000::ms => now; |
| 26 |
// stop recording; |
| 27 |
loopme.record(0); |
| 28 |
|
| 29 |
// next, start playing what was just recorded... |
| 30 |
|
| 31 |
// set playback rate |
| 32 |
loopme.rate(1.5); |
| 33 |
// set loop to true |
| 34 |
loopme.loop(1); |
| 35 |
// enable bi-directional looping |
| 36 |
loopme.bi(1); |
| 37 |
// play (voice 0) |
| 38 |
loopme.play(1); |
| 39 |
|
| 40 |
// keep alive loop |
| 41 |
while( true ) |
| 42 |
{ 500::ms => now; } |
| 43 |
|
| 44 |
// bye bye |