Debian Codegraph @

examples/special/LiSa-track2.ck

raw
1 //--------------------------------------------------------------------
2 // name: LiSa-track2.ck
3 // desc: Live sampling utilities for ChucK
4 // demonstrate using track == 1 mode with LiSa
5 //
6 // author: Dan Trueman, 2007
7 //
8 // when track == 1, the input is used to control playback position
9 // input [0,1] will control playback position within loop marks input
10 // values less than zero are multiplied by -1, so it is possible to
11 // use audio signals [-1, 1] to control playback position, as in
12 // waveshaping
13 //--------------------------------------------------------------------
14 // signal chain; record a sine wave, play it back
15 SinOsc s => LiSa loopme => dac;
16 // frequency
17 440 => s.freq;
18 // gain
19 0.25 => s.gain;
20
21 // alloc memory
22 6::second => loopme.duration;
23 1000::ms => loopme.loopEndRec;
24 1000::ms => loopme.loopEnd;
25
26 // set recording ramp time
27 loopme.recRamp(50::ms);
28
29 // start recording input
30 loopme.record(1);
31 // wait for a second
32 1000::ms => now;
33 // stop recording input
34 loopme.record(0);
35
36 // set track mode to 1, where the input chooses playback position
37 1 => loopme.track;
38 // set frequency
39 0.5 => s.freq;
40 // need to reset gain if we want to get the full loop length
41 1 => s.gain;
42 // set lisa gain
43 loopme.gain( 0.75 );
44 // play
45 loopme.play( 1 );
46
47 // advance time for 5 seconds
48 5000::ms => now;
49 // ramp down
50 loopme.rampDown( 250::ms );
51 // wait
52 500::ms => now;
53
54 // bye bye