«Beat slicer» by Brusli
on 22 Oct'13 12:09 inbeat slicer
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
( b = Buffer.read(s, "C:/Documents and Settings/brusli/Desktop/d1.wav"); p = SoundFile.collectIntoBuffers("C:/Documents and Settings/brusli/Desktop/samples/*"); ) ( ~bpm = 190; ~n = 8; ~dur = 60 / ~bpm / 2; SynthDef(\sampler, { arg buff = b, pos, len, g_size, sel_stream, st_size = 0.5; var slice, rd, out, dry, // slices vars rd1, rd2, hann1, hann2, pos1, pos2, gr1, gr2, // t_stretch vars st, stut; // stutter slice = BufFrames.kr(buff) / ~n; // read slices rd = Line.ar(pos * slice, (pos * slice) + (slice * len), ~dur * len, doneAction: 2); dry = BufRd.ar(2,buff,rd); // time stretch rd1 = LFSaw.ar(1000 / g_size, 1, 0.5, 0.5); hann1 = (rd1 * pi).sin; pos1 = Latch.ar(Line.ar(pos * slice, (pos * slice) + slice, ~dur * len, doneAction: 2), rd1 > 0.99); gr1 = BufRd.ar(2,buff, (rd1 * 44.1 * g_size) + pos1) * hann1; rd2 = Wrap.ar(rd1 + 0.5); hann2 = (rd2 * pi).sin; pos2 = Latch.ar(Line.ar(pos * slice, (pos * slice) + slice, ~dur * len, doneAction: 2), rd2 > 0.99); gr2 = BufRd.ar(2,buff, (rd2 * 44.1 * g_size) + pos2) * hann2; // stt stut = LFSaw.ar((1000 / (slice / 44.1)) / st_size ,1, 0.5, 0.5); st = BufRd.ar(2, buff, (slice * pos) + (stut * slice * st_size)) * 0.75; out = Select.ar(sel_stream, [dry, gr1 + gr2, st]); Out.ar(2, out); }).add; SynthDef(\p_shift, {arg pitch; var in, rd1, rd2, hann1, hann2, snd1, snd2; in = In.ar(2,2); rd1 = LFSaw.ar(pitch, 1, 0.5, 0.5); hann1 = (rd1 * pi).sin; rd2 = Wrap.ar(rd1 + 0.5); hann2 = (rd2 * pi).sin; snd1 = AllpassL.ar(in, 1, rd1 * 0.01,0) * hann1; snd2 = AllpassL.ar(in, 1, rd2 * 0.01,0) * hann2; Out.ar(0, snd1 + snd2); }).add; ) ( var len, buff, sel, size, count, st_size, pitch, sh = Synth(\p_shift); ~fX = Task({ inf.do({ if(rrand(0,10) > 8,{pitch = [-50,50].choose}, {pitch = 10}); if(rrand(0,10) < 4, {buff = p[rrand(0,p.size - 1)]}, {buff = b}); count = rrand(0,50); if(count < 40, {sel = 0}, if((count > 39) && (count < 45),{size = rrand(20,50); sel = 1}, if((count > 44) && (count < 51), {st_size = [0.5, 0.25, 0.125].choose; sel = 2} ))); ~dur.wait; }); }).play; ~t = Task({ inf.do({ len = rrand(2,3); sh.set(\pitch, pitch); Synth(\sampler, [\g_size, size, \sel_stream ,sel, \buff, buff, \pos, rrand(0,7), \len, len, \st_size, st_size]); (~dur * len).wait; }); }).play; )
reception
Hi, where can I find the samples used in this code, please ?
https://www.dropbox.com/s/ei04zk09m2nblj3/Desktop.zip