| 1 |
//----------------------------------------------------------------------------- |
| 2 |
// name: readme-LiSa1.ck |
| 3 |
// desc: Live sampling utilities for ChucK |
| 4 |
// |
| 5 |
// the LiSa ugens allow realtime recording of audio to a buffer for |
| 6 |
// various kinds of manipulation. Below is a simple example |
| 7 |
// demonstrating the basic functionality of LiSa. |
| 8 |
// |
| 9 |
// See readme-LiSa2.ck for a command summary and instructions for |
| 10 |
// doing multiple voice playback. |
| 11 |
// |
| 12 |
// author: Dan Trueman, 2007 |
| 13 |
//----------------------------------------------------------------------------- |
| 14 |
|
| 15 |
// signal chain; record a sine wave, play it back |
| 16 |
SinOsc s => LiSa saveme => dac; |
| 17 |
// monitor the input |
| 18 |
s => dac; |
| 19 |
|
| 20 |
// alloc memory; required |
| 21 |
6::second => saveme.duration; |
| 22 |
// freq |
| 23 |
440 => s.freq; |
| 24 |
// gain |
| 25 |
0.25 => s.gain; |
| 26 |
|
| 27 |
// start recording input |
| 28 |
saveme.record(1); |
| 29 |
// let time pass for 2 seconds |
| 30 |
.5::second => now; |
| 31 |
// stop recording |
| 32 |
saveme.record(0); |
| 33 |
|
| 34 |
// disconnect; stop monitoring input |
| 35 |
s =< dac; |
| 36 |
|
| 37 |
// start playing what was just recorded, with panning... |
| 38 |
// set playback rate |
| 39 |
saveme.rate(1.5); |
| 40 |
// set pan (0 is hard left, 1 is hard right) |
| 41 |
saveme.pan(0.0); |
| 42 |
// start playing, with a ramp up |
| 43 |
// (use saveme.play(1) to start playing without ramp) |
| 44 |
saveme.rampUp(500::ms); |
| 45 |
|
| 46 |
// hang for a bit |
| 47 |
500::ms => now; |
| 48 |
|
| 49 |
// rampdown |
| 50 |
// (use saveme.play(0) to stop playing without ramp) |
| 51 |
saveme.rampDown( 500::ms ); |
| 52 |
|
| 53 |
// wait for ramp to finish |
| 54 |
600::ms => now; |
| 55 |
|
| 56 |
// bye bye |