{
   "id" : "1-58C",
   "is_private" : null,
   "code" : "(\r\ns.waitForBoot({\r\n\tvar intro, introFasterAttack, fastarpeggio, arpeggio, percussion, flute, lead1, bass, score;\r\n\tvar parser = TheoryNoteParser.new;\r\n\r\n\tSynthDef(\\fatsaw, {\r\n\t\t| out=0, freq = 440, amp=0.1, gate=1, attack=0.01, decay=0.3, sustain=0.5, release=1, filterSpeed=100, filterFreqStart=300, filterFreqEnd=400, resonance=1, hfFilterFreq=1, hfFilterResonance=1 |\r\n\t\tvar sig, env, filtFreq;\r\n\t\tenv = EnvGen.ar(Env.adsr(attack, decay, sustain, release), gate, levelScale:0.5, doneAction:Done.freeSelf);\r\n\t\tsig = env*Splay.ar(LFSaw.ar(freq*[0.98,0.99,1.0,1.01,1.02],[LFNoise0.kr(2), LFNoise0.kr(1.9), LFNoise0.kr(2.1)]) + SinOsc.ar(freq*[0.98,0.99,1.0,1.01,1.02],[LFNoise0.kr(2), LFNoise0.kr(1.9), LFNoise0.kr(2.1)]));\r\n\t\tfiltFreq = LFSaw.kr(filterSpeed,iphase:1).range(filterFreqStart,filterFreqEnd);\r\n\t\tsig = RLPF.ar(sig, filtFreq, resonance);\r\n\t\tsig = RHPF.ar(sig, hfFilterFreq, hfFilterResonance);\r\n\t\t2.do({\r\n\t\t\tsig = AllpassN.ar(sig, 0.050, [0.050.rand, 0.050.rand], 1);\r\n\t\t});\r\n\t\tOut.ar(out, amp*sig.tanh);\r\n\t}).add;\r\n\r\n\tSynthDef(\\organ, {\r\n\t\t| out = 0, freq = 440, amp=0.1, gate=1, attack=0.01, decay=0.3, sustain=0.5, release=1 |\r\n\t\tvar sig, env;\r\n\t\tsig = 0.5*Klang.ar(`[[freq/8, freq/4, freq/2, freq, freq*2, freq*4, freq*8],[0.7, 0.7, 0.7, 1, 1, 0.6, 0.4],[0,0.1,0.2,0.3,0.4,0.5,0.6]]);\r\n\t\tsig = RLPF.ar(sig, 5000, 1);\r\n\t\tenv = EnvGen.ar(Env.adsr(attack,decay, sustain, release), gate, doneAction:Done.freeSelf);\r\n\t\tsig = env*sig;\r\n\t\t4.do({\r\n\t\t\tsig = AllpassN.ar(sig, 0.050, [0.050.rand, 0.050.rand], 1);\r\n\t\t});\r\n\t\tOut.ar(out, amp*sig.tanh);\r\n\t}).add;\r\n\r\n\tSynthDef(\\kick, {\r\n\t\t|out = 0, pan = 0, amp = 0.3, filterFreq=100|\r\n\t\tvar body, bodyFreq, bodyAmp;\r\n\t\tvar pop, popFreq, popAmp;\r\n\t\tvar click, clickAmp;\r\n\t\tvar snd;\r\n\r\n\t\t// body starts midrange, quickly drops down to low freqs, and trails off\r\n\t\tbodyFreq = EnvGen.ar(Env(0.7*[261, 120, 51], [0.035, 0.08], curve: \\exp));\r\n\t\tbodyAmp = EnvGen.ar(Env.linen(0.005, 0.1, 0.3), doneAction: 2);\r\n\t\tbody = LFTri.ar(bodyFreq) * bodyAmp;\r\n\t\t// pop sweeps over the midrange\r\n\t\tpopFreq = XLine.kr(750, 261, 0.02);\r\n\t\tpopAmp = EnvGen.ar(Env.linen(0.001, 0.02, 0.001)) * 0.15;\r\n\t\tpop = LFTri.ar(popFreq) * popAmp;\r\n\t\t// click is spectrally rich, covering the high-freq range\r\n\t\t// you can use Formant, FM, noise, whatever\r\n\t\tclickAmp = EnvGen.ar(Env.perc(0.001, 0.01)) * 0.15;\r\n\t\tclick = LPF.ar(Formant.ar(910, 4760, 2110), 3140) * clickAmp;\r\n\r\n\t\tsnd = body + pop + click;\r\n\t\tsnd = RLPF.ar(snd, filterFreq);\r\n\t\tsnd = snd.tanh;\r\n\r\n\t\tOut.ar(out, Pan2.ar(snd, pan, amp));\r\n\t}).add;\r\n\r\n\ts.sync;\r\n\r\n\t~tempoFactor = 0.18;\r\n\r\n\tintro = Pbind(\r\n\t\t\\instrument, \\fatsaw,\r\n\t\t\\amp, 1.2,\r\n\t\t\\attack, 3,\r\n\t\t\\decay, 0.1,\r\n\t\t\\sustain, 1,\r\n\t\t\\release, 5,\r\n\t\t\\filterSpeed, Pfunc({~tempoFactor*0.5}),\r\n\t\t\\filterFreqStart, 50,\r\n\t\t\\filterFreqEnd, 800,\r\n\t\t\\midinote, Pseq([\"e3 g3 b3\"].collect({|el| parser.asMidi(el)}), 1),\r\n\t\t\\dur, Pseq([6],1));\r\n\t//intro.play;\r\n\r\n\tintroFasterAttack = Pbind(\r\n\t\t\\instrument, \\fatsaw,\r\n\t\t\\amp, 0.5,\r\n\t\t\\attack, 0.01,\r\n\t\t\\decay, 0.3,\r\n\t\t\\sustain, 1,\r\n\t\t\\release, 2,\r\n\t\t\\filterSpeed, Pfunc({1/(~tempoFactor*6*4);}),\r\n\t\t\\filterFreqStart, 50,\r\n\t\t\\filterFreqEnd, 3000,\r\n\t\t\\midinote, Pseq([\"e3 g3 b3\"].collect({|el| parser.asMidi(el)}), 1),\r\n\t\t\\dur, 4);\r\n\r\n\tfastarpeggio = Pbind(\r\n\t\t\\instrument, \\organ,\r\n\t\t\\amp, Pseq([0.6,0.15,0.2,0.25,0.3,0.25,0.2,0.15]*0.1, inf),\r\n\t\t\\attack, 0.1,\r\n\t\t\\decay, 0.1,\r\n\t\t\\sustain, 0.3,\r\n\t\t\\release, 1,\r\n\t\t\\dur, Pfunc({~tempoFactor/2}),\r\n\t\t\\midinote, Pseq(parser.asMidi(\"c5 e5 g5 b5 c6 b5 g5 e5\"), 6)\r\n\t);\r\n\t//fastarpeggio.play;\r\n\r\n\tpercussion = Pbind(\r\n\t\t\\instrument, \\kick,\r\n\t\t\\amp, Pseq([0.9,0.8], inf),\r\n\t\t\\filterFreq, Pseq([Pseq([1000], 4), Pseq([2000], 4)], inf),\r\n\t\t\\dur, Pseq([~tempoFactor], inf),\r\n\t\t\\filterSpeed, 0.1,\r\n\t\t\\filterFreqStart, 50,\r\n\t\t\\filterFreqEnd, 300,\r\n\t\t\\midinote, Pseq(parser.asMidi(\"c3 c3\") ++ [Rest(), Rest()], 60),\r\n\t);\r\n\t//percussion.play;\r\n\r\n\tarpeggio = Pbind(\r\n\t\t\\instrument, \\fatsaw,\r\n\t\t\\amp, 0.6,\r\n\t\t\\attack, 0.01,\r\n\t\t\\decay, 0.3,\r\n\t\t\\sustain, 0.1,\r\n\t\t\\release, 0.4,\r\n\t\t\\time, Ptime(inf),\r\n\t\t\\resonance, Pfunc({ |ev| ev['time'].linexp(0,10,1,0.2); }),\r\n\t\t\\midinote, Pseq(parser.asMidi(\"c2 e2 g2 b2 c3 b2 g2 e2\"), 14+4+4+6),\r\n\t\t\\dur, Pfunc({~tempoFactor}));\r\n\t//arpeggio.play;\r\n\r\n\tflute = Pbind(\r\n\t\t\\instrument, \\fatsaw,\r\n\t\t\\amp, 0.4,\r\n\t\t\\attack, 3,\r\n\t\t\\decay, 0.3,\r\n\t\t\\sustain, 3,\r\n\t\t\\release, 4,\r\n\t\t\\filterSpeed, Pfunc({~tempoFactor}),\r\n\t\t\\filterFreqStart, 200,\r\n\t\t\\filterFreqEnd, 6000,\r\n\t\t\\midinote, Pseq([\"g4 b4 g5 b5\"].collect({|el| parser.asMidi(el); }), 1),\r\n\t\t\\dur, Pfunc({~tempoFactor*5});\r\n\t);\r\n\r\n\tlead1 = Pbind(\r\n\t\t\\instrument, \\fatsaw,\r\n\t\t\\amp, 0.2,\r\n\t\t\\attack, 0.01,\r\n\t\t\\decay, 0.3,\r\n\t\t\\sustain, 1,\r\n\t\t\\release, 1,\r\n\t\t\\resonance, 0.2,\r\n\t\t\\filterSpeed, Pfunc({~tempoFactor}),\r\n\t\t\\filterFreqStart, 3000,\r\n\t\t\\filterFreqEnd, 4000,\r\n\t\t\\hfFilterFreq, 10,\r\n\t\t\\midinote, Pseq([\"b1 b2 b3\", \"g2 g3 g4\"].collect({|el| parser.asMidi(el)}), 1),\r\n\t\t\\dur, Pfunc({~tempoFactor*4}),\r\n\t);\r\n\r\n\t//lead1.play;\r\n\r\n\tbass = Pbind(\r\n\t\t\\instrument, \\fatsaw,\r\n\t\t\\amp, Pseq([0.3, 0.2, 0.2, 0.18, 0.2, 0.18, 0.2, 0.18]*2,inf),\r\n\t\t\\attack, 0.01,\r\n\t\t\\decay, 0.5,\r\n\t\t\\sustain, Pseq([1,0.7,1,0.7],inf),\r\n\t\t\\release, 8,\r\n\t\t\\filterSpeed, 0.1,\r\n\t\t\\filterFreqStart, 2000,\r\n\t\t\\filterFreqEnd, 3000,\r\n\t\t\\resonance, 0.8,\r\n\t\t\\hfFilterFreq, 5,\r\n\t\t\\midinote, Pseq([\"c1 c2 c3\", \"d1 d2 d3 \", \"e1 e2 e3\", \"d1 d2 d3\"].collect({|el| parser.asMidi(el)}), 2),\r\n\t\t\\dur, Pseq([~tempoFactor*24, ~tempoFactor*8, ~tempoFactor*24, ~tempoFactor*8],inf)\r\n\t);\r\n\t//bass.play;\r\n\r\n\tscore = Ptpar([\r\n\t\t0.0, intro,\r\n\t\t0.0, fastarpeggio,\r\n\t\t~tempoFactor*8*3, percussion,\r\n\t\t~tempoFactor*8*3, arpeggio,\r\n\t\t~tempoFactor*8*9, introFasterAttack,\r\n\t\t~tempoFactor*8*10, flute,\r\n\t\t~tempoFactor*8*13, lead1,\r\n\t\t~tempoFactor*8*14, bass\r\n\t]);\r\n\tscore.play;\r\n});\r\n)",
   "labels" : [
      "subtractive",
      "theoryquark",
      "stranger things",
      "theme"
   ],
   "description" : "First 30 seconds or so of the obligatory \"stranger things\" theme. I didn't make any serious attempt to perfectly clone the original sounds, but I feel like they live in a similar sonic universe. For my own convenience, this depends on the TheoryQuark from https://github.com/shimpe/theoryquark : just unpack it in the directory that opens when you open scide -> \"file menu\" -> \"open user support directory\" and then restart scide (or recompile the class library using the \"language\" -> \"recompile class library\" menu). It uses some instruments I made myself, as well as some I collected from sources which unfortunately I don't remember (probably sccode.org and/or mailing list).",
   "ancestor_list" : [],
   "name" : "stranger things",
   "author" : "56228375"
}
