Debian Codegraph @

examples/special/LiSa-track1.ck

raw
1 //--------------------------------------------------------------------
2 // name: LiSa-track1.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 values
10 // less than zero are multiplied by -1, so it is possible to use audio
11 // signals [-1, 1] to control playback position, as in waveshaping
12 //--------------------------------------------------------------------
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 LiSa 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(25::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 // note that you can still record this input
38 1 => loopme.track;
39 // disconnect sinosc as input
40 s =< loopme;
41 // use envelope to control playback position
42 Step i => Envelope e => loopme;
43 // set step hold value
44 1 => i.next;
45
46 // play it forward twice speed
47 500::ms => e.duration;
48 // open envelope
49 e.keyOn();
50 // play
51 loopme.play(1);
52 // advance time
53 500::ms => now;
54
55 // now backwards half speed
56 2000::ms => e.duration;
57 // close envelope
58 e.keyOff();
59 // advance time
60 2000::ms => now;
61 // stop playing
62 loopme.play(0);
63
64 // bye bye