Debian Codegraph @

examples/basic/valueat.ck

raw
1 // for demo'ing SndBuf.valueAt() and using Impulse to render
2 // audio one-sample-at-a-time; not a conventional use case
3 // (see sndbuf.ck or otf_01.ck for more conventional usage of sndbuf)
4
5 // use this for reading from file only
6 SndBuf buf;
7 // read a file
8 me.dir() + "../data/kick.wav" => buf.read;
9
10 // the patch (no sndbuf involved)
11 Impulse i => dac;
12
13 // infinite time-loop
14 while( true )
15 {
16 // index
17 int pos;
18 // repeat this many times
19 repeat( buf.samples() )
20 {
21 // set next sample
22 buf.valueAt( pos ) => i.next;
23 // increment index
24 pos++;
25 // advance time by one samp
26 1::samp => now;
27 }
28 }