2 summary:: Warp a buffer with a time pointer
3 categories:: UGens>Buffer, UGens>Generators>Granular
6 Inspired by Chad Kirby's SuperCollider2 Warp1 class, which was inspired by Richard Karpen's sndwarp for CSound. A granular time strecher and pitchshifter.
13 the number of channels in the soundfile used in bufnum.
16 the buffer number of a mono soundfile.
19 the position in the buffer. The value should be between 0 and 1, with 0 being the begining
20 of the buffer, and 1 the end.
23 the amount of frequency shift. 1.0 is normal, 0.5 is one octave down, 2.0 is one octave up.
24 Negative values play the soundfile backwards.
27 the size of each grain window.
30 the buffer number containing a singal to use for the grain envelope. -1 uses a built-in
34 the number of overlaping windows.
36 argument::windowRandRatio
37 the amount of randomness to the windowing function. Must be between 0 (no
38 randomness) to 1.0 (probably to random actually)
41 the interpolation method used for pitchshifting grains. 1 = no interpolation. 2 = linear.
42 4 = cubic interpolation (more computationally intensive).
50 // a custom envelope - not a very good one, but you can hear the difference between this
52 winenv = Env([0, 1, 0], [0.5, 0.5], [8, -8]);
53 b = Buffer.read(s, Help.dir +/+ "sounds/a11wlk01-44_1.aiff");
54 z = Buffer.sendCollection(s, winenv.discretize, 1);
56 SynthDef(\warp, {arg buffer = 0, envbuf = -1;
57 var out, pointer, filelength, pitch, env, dir;
58 // pointer - move from beginning to end of soundfile over 15 seconds
59 pointer = Line.kr(0, 1, 15);
60 // control pitch with MouseX
61 pitch = MouseX.kr(0.5, 2);
62 env = EnvGen.kr(Env([0.001, 1, 1, 0.001], [0.1, 14, 0.9], 'exp'), doneAction: 2);
63 out = Warp1.ar(1, buffer, pointer, pitch, 0.1, envbuf, 8, 0.1, 2);
70 x = Synth(\warp, [\buffer, b, \envbuf, -1])
72 // switch to the custom env