Last active
October 8, 2016 17:56
-
-
Save tatecarson/06ab72a6cb5c5da21d9039d82bf58d31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SynthDef(\klankDrone, {|out = 0, klankfreqs = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], | |
klankamps = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], | |
rings = #[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], pan = 0, bufnum, rate = 1 | |
amp = 0.2, ffreq = 440, saturation = 1, klankmix = 0, pointer, warpRate = 1, droneMix = 0 | |
pos = 0, envTime = 1, atk = 0.5, rel = 0.5, susLevel = 1, envCurve = 1, masterDist = 0.5, | |
wdrop = 20, wmode = 1| | |
var sig, localBuf, record, droned, klank; | |
var e = EnvGen.kr(Env.new([0, susLevel, 0], [atk, rel].normalizeSum, envCurve), timeScale: envTime, doneAction:2); | |
var i = PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum)*rate, startPos: BufFrames.kr(bufnum)*pos); | |
var z = Klank.ar(`[klankfreqs, klankamps, rings], i); | |
klank = SelectX.ar(klankmix, [i, z]); //mix between klanked and dry sample | |
klank = WaveLoss.ar(klank, wdrop, mode: wmode); | |
localBuf = LocalBuf.new(SampleRate.ir * 1, 2).clear; //hold sample in a drone | |
record = RecordBuf.ar(klank, localBuf, loop: 0); | |
droned = Warp1.ar(1, localBuf, pointer, warpRate, 0.1, -1, 8, 0.1, 2); | |
droned = BMoog.ar(droned, ffreq, saturation: saturation); | |
sig = SelectX.ar(droneMix, [klank, droned]); | |
sig = sig + SineShaper.ar(sig, mul: masterDist); //add a little distortion to everything | |
sig = Limiter.ar(sig); | |
Out.ar(out, Pan2.ar(sig*e*amp, pan)); | |
}).add; | |
( | |
Pbindef(\klank, | |
\instrument, \klankDrone, | |
\bufnum, b[\cuts][(0..b[\cuts].size).choose], | |
\klankfreqs, Pfunc{[800.linrand.dup(12), 12000.linrand.dup(12)].choose}, | |
\klankamps, Pfunc{{0.1.rrand(1)}.dup(12)}, | |
\rings, Pfunc{{5.rrand(7)}.dup(12)}, | |
\klankmix, Phprand(0.0, 1.0), // 0 - dry sample, 1 - klanked sample | |
\rate, Pmeanrand(0.7, 1.3), //original sample tuning | |
\droneMix, Pmeanrand(0.0, 1.0), // 0 - klank, 1 - warp1 drone | |
\pointer, Pwhite(0.0, 1.0), //position in drone | |
\warpRate, Pwhite(0.1, 1.0), //tuning of drone | |
\ffreq, Pwhite(100,300), //moog cutoff | |
\saturation, Pwhite(0.6, 2.0), //moog saturation | |
\pos, Pwhite(0, 1.0), | |
\atk, Pexprand(0.01, 0.5), | |
\rel, Pexprand(0.03, 0.5), | |
\susLevel, Pmeanrand(0.0, 1.0), | |
\envCurve, Pwhite(-4, 4), | |
\envTime, Pwrand([1, 2, 3, 4, 5, 10], [1, 2, 4, 3, 10, 1].normalizeSum, inf).trace, | |
\dur, Pkey(\envTime), | |
\amp, 0.13, //master amp | |
\masterDist, Pbrown(0.1, 1, 0.4), | |
\wdrop, Prand([1, 15, 20, 35], inf), | |
\wmode, Prand([1, 2], inf), | |
\pan, Pwhite(0.0, 1.0), | |
).play; | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment