# «I need you» by 56228375

on 07 Aug'17 18:13 inIannis 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.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43

( s.waitForBoot({varsquiggleBus; squiggleBus =Bus.control(s,6);SynthDef(\generateINeedYouSquiggle, { | controlOutBus |vartime, speed, rotations, commonpart, xy, sc;// a nice squiggle in polar coordinates: r = sin(6*phi) +2// convert to parametric equations:// commonpart = sin(6*t)+2// x(t) = commonpart*sin(t)// y(t) = commonpart*cos(t)// where t is provided by a low frequency sawtooth wavespeed =1; rotations =1; time =LFSaw.kr(freq:speed, iphase:1).range(0, speed*rotations); commonpart =SinOsc.kr(5*time) +2;// flower shapexy = [commonpart*SinOsc.kr(time), commonpart*SinOsc.kr(time, pi/2), -3,3, -3,3];// x and ysc = (xy*vary between -3and30.2).scope;// for visualization onlyOut.kr(controlOutBus, xy); }).add;SynthDef(\squiggleTestAutomatic, { | out =0, controlInBus |varsig, xy;// read the xy control values in the form [ x, y, minx, maxx, miny, maxy]xy =In.kr(controlInBus,6);// and use them in the synthsig =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), xy[1].linlin(xy[4],xy[5],50,1000),0.1),0.1,0.1,5,0.6),0.0);Out.ar(out, sig); }).add; s.sync; x =Synth(\generateINeedYouSquiggle, [controlOutBus: squiggleBus]);Synth.after(x,\squiggleTestAutomatic, [controlInBus: squiggleBus]); }); )

raw 1427 chars (focus & ctrl+a+c to copy)

reception

Nice code and blog post ! I've added your supercollider rss to SC Planet : http://scplanet.tuxfamily.org/ :)

Hey, thanks! But not all my posts are supercollider related. Can it be filtered based on a tag e.g.?

yes I found the rss specific to your supercollider tag =)

The version as posted here sounds better so I'll keep it, but if you strictly follow the theory from the blog post, lines 17-19 should read:

time = LFSaw.kr(freq:speed, iphase:1).range(0, speed*rotations*2*pi); commonpart = sin(5*time) + 2; // flower shape xy = [commonpart*sin(time), commonpart*cos(time), -3, 3, -3, 3]; // x and y vary between -3 and 3

My (lucky) mistake...