{
   "description" : "Iannis Xenakis begging us from the grave: \"I need you! I need you! I need you!...\". This code is based on an example from the Help  documents that uses MouseX.kr and MouseY.kr, but I've replaced the MouseX and MouseY with a \"2d squiggle\". I wrote a blog post that explains how to generate \"2d squiggles\" like these (as well as completely different ones) - see http://technogems.blogspot.be/2017/08/automating-squiggles-in-supercollider.html . If you run the code also a scope will appear. Put it in X/Y mode to see the squiggle as it is being generated and executed.",
   "ancestor_list" : [],
   "name" : "I need you",
   "author" : "56228375",
   "is_private" : null,
   "id" : "1-57x",
   "code" : "(\r\ns.waitForBoot({\r\n\tvar squiggleBus;\r\n\tsquiggleBus = Bus.control(s, 6);\r\n\r\n\tSynthDef(\\generateINeedYouSquiggle, {\r\n\t\t| controlOutBus |\r\n\t\tvar time, speed, rotations, commonpart, xy, sc;\r\n\t\t// a nice squiggle in polar coordinates: r = sin(6*phi) + 2\r\n\t\t// convert to parametric equations:\r\n\t\t// commonpart = sin(6*t)+2\r\n\t\t// x(t) = commonpart*sin(t)\r\n\t\t// y(t) = commonpart*cos(t)\r\n\t\t// where t is provided by a low frequency sawtooth wave\r\n\t\tspeed = 1;\r\n\t\trotations = 1;\r\n\t\ttime = LFSaw.kr(freq:speed, iphase:1).range(0, speed*rotations);\r\n\t\tcommonpart = SinOsc.kr(5*time) + 2; // flower shape\r\n\t\txy = [commonpart*SinOsc.kr(time), commonpart*SinOsc.kr(time, pi/2), -3, 3, -3, 3]; // x and y vary between -3 and 3\r\n\t\tsc = (xy*0.2).scope; // for visualization only\r\n\t\tOut.kr(controlOutBus, xy);\r\n\t}).add;\r\n\r\n\tSynthDef(\\squiggleTestAutomatic, {\r\n\t\t| out = 0, controlInBus |\r\n\t\tvar sig, xy;\r\n\r\n\t\t// read the xy control values in the form [ x, y, minx, maxx, miny, maxy]\r\n\t\txy = In.kr(controlInBus, 6);\r\n\r\n\t\t// and use them in the synth\r\n\t\tsig = Pan2.ar(CombN.ar(Resonz.ar(Gendy5.ar(2,3,minfreq:1,maxfreq:xy[0].linlin(xy[2],xy[3],10,700), durscale:0.1, initCps:10),\r\n\t\t\txy[1].linlin(xy[4],xy[5],50,1000), 0.1), 0.1, 0.1, 5, 0.6), 0.0);\r\n\t\tOut.ar(out, sig);\r\n\r\n\t}).add;\r\n\r\n\ts.sync;\r\n\r\n\tx = Synth(\\generateINeedYouSquiggle, [controlOutBus: squiggleBus]);\r\n\tSynth.after(x, \\squiggleTestAutomatic, [controlInBus: squiggleBus]);\r\n});\r\n)",
   "labels" : [
      "xenakis",
      "squiggle",
      "gendy"
   ]
}
