{
   "author" : "rwentk",
   "name" : "Nooge",
   "description" : "Sort of analog-ish non-shiny largo pads modulating forever.",
   "ancestor_list" : [],
   "labels" : [
      "ambient",
      "analog",
      "generative",
      "infinite",
      "pentatonic",
      "moog",
      "svf",
      "chill"
   ],
   "id" : "1-4Rh",
   "is_private" : null,
   "code" : "//Drifty noodle machine\r\n\r\n(\r\nSynthDef(\\StereoModDelay, { arg\r\n    //Chorus delay with EQ in the feedback loop\r\n    //for that vintage tape echo mood\r\n\r\n\tbufferL,\r\n\tbufferR,\r\n\ttime = 1.5,\r\n\tfb = 0.8,\r\n\tmodRate = 5.5,\r\n\tmodDepth = 0.0005,\r\n\teqFc = 800,\r\n\teqQ = 3;\r\n\t\r\n\tvar signal, tapPhase, tap, tapPhaseL, tapPhaseR, tapL, tapR;\r\n\tvar timeMod, eqMod;\r\n\t\r\n\t//Drop the input slightly to avoid clicky clipping\r\n\tsignal = 0.7*In.ar(18, 2);\r\n    signal = signal + LocalIn.ar(2);\r\n    \r\n    timeMod = LFDNoise3.ar(modRate, modDepth);\r\n    eqMod = LFDNoise3.kr(1, 400);\r\n    \r\n\ttapPhaseL = DelTapWr.ar(bufferL, signal[0]);\r\n\ttapL = DelTapRd.ar(bufferL, tapPhaseL, time+LFDNoise3.ar(modRate, modDepth), 2);\r\n\ttapL = BBandPass.ar(tapL, eqFc+eqMod, eqQ);\r\n\t\r\n\ttapPhaseR = DelTapWr.ar(bufferR, signal[1]);\r\n\ttapR = DelTapRd.ar(bufferR, tapPhaseR, time+LFDNoise3.ar(modRate, modDepth), 2);\r\n\ttapR = BBandPass.ar(tapR, eqFc+eqMod, eqQ);\r\n\r\n\t//Restore the output level\r\n\tOut.ar(0,[1.4*tapL, 1.4*tapR]);\r\n\tLocalOut.ar(fb*[tapR, tapL]);\r\n}).add;\r\n\r\nSynthDef(\\Filters, { arg\r\n\t//Slowly varying bp filter applied across the mix\r\n\t//Creates a subtle phasing effect\r\n\tcutoffBase = 500,\r\n\tcutoffMod = 2000,\r\n\tresBase = 0.3,\r\n\tlpVol = 0,\r\n\tbpVol = 1,\r\n\thpVol = 0,\r\n\tnotchVol = 0,\r\n\tpeakVol = 0;\r\n\t\r\n\tvar signal = In.ar(16,2);\r\n\t\r\n\t//Modulated sine wave modulation source\r\n\tvar modSig = SinOsc.ar(0.05+0.5*LFDNoise3(1), 0, 0.5, 0.5);\r\n\t\r\n\t//Two 12dB LPFs for 24db total\r\n\t//\r\n\tvar output = SVF.ar(signal, cutoffBase + (modSig*cutoffMod), resBase, lpVol, bpVol, hpVol, notchVol, peakVol);\r\n\toutput = 4*SVF.ar(output, cutoffBase + (modSig*cutoffMod), resBase, lpVol, bpVol, hpVol, notchVol, peakVol);\r\n\t\r\n\tOut.ar([0,1], output);\r\n\tOut.ar([18, 19], output);\r\n}).add;\t\r\n\r\nSynthDef(\\ChMach, { arg \r\n\tf=440, \r\n\twidth = 0.5, \r\n\tmodFreq = 1,\r\n\taTime = 5,\r\n\trTime = 5,\r\n\tfilter = 2,\r\n\tfilterQ = 0,\r\n\tpan = 0.5;\r\n\t\r\n\t\r\n\t var env = EnvGen.ar(Env([0.01,1,0.01],[aTime, rTime], 'exp'),  doneAction:2);\r\n\t\r\n     var input = Vibrato.ar(VarSaw.ar(f, 0, LFNoise2.kr(1)), 5, 0.1, 0, 0.2, 0.1, 0.7);\r\n\tvar theSine = SinOsc.ar(f); \r\n\r\n//\tvar theSaw = VarSaw.ar(f*1.5, 0, width);\r\n\r\n// Emulate six unsynched LFOs driving six comparators for a multi-pulse chorus\r\n\r\n\tvar oscs = 6;\r\n\tvar scaler = 1/oscs;\r\n\t\r\n\tvar lfo1 = LFTri.ar(modFreq*1.51); \r\n\tvar lfo2 = LFTri.ar(modFreq*1.11); \r\n\tvar lfo3 = LFTri.ar(modFreq*1.31); \r\n\tvar lfo4 = LFTri.ar(modFreq*0.71);\r\n\tvar lfo5 = LFTri.ar(modFreq*0.61);  \r\n\tvar lfo6 = LFTri.ar(modFreq*0.51);  \r\n\t\r\n\tvar comp1 = input > lfo1; \r\n\tvar comp2 = input > lfo2;\r\n\tvar comp3 = input > lfo3;\r\n\tvar comp4 = input > lfo4;\r\n\tvar comp5 = input > lfo5;\r\n\tvar comp6 = input > lfo6;\r\n\t\r\n\tvar output = scaler*(comp1+comp2+comp3+comp4+comp5+comp6);\r\n\t//Add a hint of fundamental for body\r\n     output = output+0.001*theSine; \r\n\t\r\n\toutput = 0.01*LeakDC.ar(output, 0.9995); \r\n\t\r\n\t//Doubled Moog with overdrive. \r\n\t//Mmmm yeah.\r\n\toutput = MoogFF.ar(output.tanh*20.0, (f*filter)+LFNoise2.ar(1, 400, 1), LFNoise2.ar(0,3.5, 0));\r\n\toutput = MoogFF.ar(output*4, f*LFNoise2.kr(0.2, 6, 4), 0.5);\r\n\t\r\n\toutput = 2*env*output.tanh;\r\n\tOut.ar(0, Pan2.ar(output, pan));\r\n\tOut.ar(16, Pan2.ar(output, pan));\r\n\tOut.ar(18, Pan2.ar(output, pan));\r\n\t \r\n}).add;\r\n);\r\n\r\n(\r\n\tvar g=Group.basicNew(s,1);\r\n\t\r\n\tvar stereoBuffer1L = Buffer.alloc(s, s.sampleRate*3, 1);\r\n\tvar stereoBuffer1R = Buffer.alloc(s, s.sampleRate*3, 1);\r\n\r\n     var monoBuffer1 = Buffer.alloc(s, s.sampleRate*2, 1);\r\n   \t\t\r\n\tvar rootPitch=36;\t\t\t\t\t\t\t\t\t\t// Start on a C\r\n\r\n\tvar stopTranspose = 0;\t\t\t\t\t\t\t\t\t\r\n\tvar transposeCount = 10;\t\t\t\t\t\t\t\t\t//Wait a while after transposing to minimise semitone clashes\r\n\t\r\n\t//Non-ET pentatonic ratios\r\n\tvar thisRatio = [0.25, 0.5, 0.75, 1, 1.125, 1.333333, 1.5, 1.6875, 2, 2.25, 2.6666666, 3, 3.375, 4, 5];\r\n\tvar thisPitch;\r\n\r\n\tvar svf = Synth.tail(g, \\Filters);\r\n\tvar d = Synth.tail(g, \\StereoModDelay);\r\n\r\n\tstereoBuffer1L.zero;\r\n\tstereoBuffer1R.zero;\r\n\td.set(\\bufferL, stereoBuffer1L);\r\n\td.set(\\bufferR, stereoBuffer1R);\r\n\t\r\n\tthisPitch = thisRatio.choose*rootPitch.midicps;\r\n\t\r\n\t//First few notes have a slow attack and longer interval\r\n\t{4.do\r\n\t\t{ \r\n\t\tSynth.head(g, \\ChMach,\r\n\t\t\t[\\f, thisPitch,\r\n\t\t\t\\width, rrand(0,1),\r\n\t\t\t\\pan, rrand(-1,1),\r\n\t\t\t\\aTime, rrand(5,15),\r\n\t\t\t\\rTime, rrand(7,20),\r\n\t\t\t\\filter, rrand(4,10),\r\n\t\t\t\\filterQ, rrand(0,3.7), \r\n\t\t\t\\modFreq, rrand(0.7,1.5)]);\r\n\t\t  rrand(1,3).wait;\r\n\t\t}\r\n\t};\r\n\t  \r\n\t//Pick a note from the pentatonic scale with somewhat random settings\r\n\t//and slowly noodle around the circle of fifths\r\n\t{inf.do \r\n\t\t{\r\n\t\tthisPitch = thisRatio.choose*rootPitch.midicps;\r\n\t\tstopTranspose = stopTranspose + 1;\r\n\t\tSynth.head(g, \\ChMach,\r\n\t\t\t[\\f, thisPitch,\r\n\t\t\t\\width, rrand(0,1),\r\n\t\t\t\\pan, rrand(-1,1),\r\n\t\t\t\\aTime, rrand(0.01,15),\r\n\t\t\t\\rTime, rrand(7,20),\r\n\t\t\t\\filter, rrand(4,10),\r\n\t\t\t\\filterQ, rrand(0,3.7), \r\n\t\t\t\\modFreq, rrand(0.7,1.5)]);\r\n\t\tif ((0.04.coin) && (stopTranspose > transposeCount)) {\r\n\t\t\tstopTranspose = 0;\r\n\t\t\trootPitch = rootPitch + 7;\r\n\t\t\tif (rootPitch > 47) {rootPitch = rootPitch - 12};\r\n\t\t\trootPitch.postln;\r\n\t\t\t};\t\r\n\t\t   rrand(0.1,2).wait;\r\n\t\t   }\r\n\t}.fork;\r\n)"
}
