source code for js2018 (disquiet0365)
| // source code for js2018 (disquiet0365) | |
| // https://disquiet.com/0365/ | |
| // randomly chosen five-second segments from 12 audio files, one for each month of the year | |
| // SuperCollider 3.10.0 | |
| ( | |
| s.waitForBoot{ | |
| var path, files; | |
| Buffer.freeAll; | |
| s.sync; | |
| // load 12 sequentially numbered audio files into an array of buffers | |
| // hack: 80secs minimum length each file, to be sure last slice does not go past end of file | |
| path = "".resolveRelative; // files in same directory as this document | |
| files = (path ++ "*.aiff").pathMatch ++ (path ++ "*.aif").pathMatch ++ (path ++ "*.wav").pathMatch; | |
| files = files.sort({ |a, b| a.basename < b.basename }); | |
| ~months = files.collect({ |i| Buffer.read(s, i)}); | |
| s.sync; | |
| // buffer slicer | |
| SynthDef(\slice, { |out, gate=1, buf, slices=16, slice=0, freq = (60.midicps), amp=0.1, pan=0.0, loop=0| | |
| var myenv, env, start, len, basefreq = 60.midicps, rate, sig; | |
| rate = freq / basefreq; | |
| len = BufFrames.kr(buf); | |
| start = (len / slices * slice); | |
| myenv = Env.asr(attackTime: 0.01, sustainLevel: 1, releaseTime: 0.1); | |
| sig = PlayBuf.ar(2, buf, BufRateScale.kr(buf) * rate, startPos: start, loop:loop); | |
| sig = Balance2.ar(sig[0],sig[1], pan); | |
| env = EnvGen.kr(myenv, gate, doneAction: 2); | |
| Out.ar(out, sig * env * amp) | |
| }).add; | |
| s.sync; | |
| //set up recording | |
| s.prepareForRecord; | |
| s.sync; | |
| s.record; | |
| // step through files and select slice from somewhere in the middle | |
| Pbind(\instrument, \slice, \buf, Pseq(~months), \slice, Prand((1..14),12), \dur, 5, \legato, 1, \amp, 0.6).trace([\buf, \slice]).play; | |
| // the finished piece | |
| 61.wait; | |
| s.stopRecording; | |
| thisProcess.platform.recordingsDir.openOS; | |
| }; | |
| ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment