{
   "labels" : [
      "3d sound",
      "sound forms",
      "el cubito de chuito",
      "the cube"
   ],
   "code" : "// El Cubito de Chuito/ Chuito's Cube for 3D Sound.  Roy F Guzmán \r\n\r\n// Instantiate as many SynthDefs as there are sound sources. The more SyntheDefs the more sources, the more sounds to produce a illusion of trajectories that when aching a liminal point of 60HZ± of velocity can achieve an illusion or an intent to create sound forms. \r\n\r\nServer.local.options.device = \"Built-In-Audio\";\r\nServer.internal.options.device = \"Built-In-Audio\";\r\nServerOptions.outDevices;\r\nServer.default.options.outDevice_(\"Built-In-Audio\");\r\n\r\ns.options.numOutputBusChannels;\r\ns.options.numOutputBusChannels = 16;\r\ns.meter;\r\n\r\ns = Server.local;\r\ns.makeGui\r\n\r\n(\r\n~jesus = Bus.audio(s, 1);\r\n~source1 = Bus.audio(s, 1);\r\n~source2 = Bus.audio(s, 1);\r\n~mult0 = Bus.audio(s, 1);\r\n~mult1 = Bus.audio(s, 1);\r\n~mult2 = Bus.audio(s, 1);\r\n~mult3 = Bus.audio(s, 1);\r\n~mult4 = Bus.audio(s, 1);\r\n~mult5 = Bus.audio(s, 1);\r\n~mult6 = Bus.audio(s, 1);\r\n~mult7 = Bus.audio(s, 1);\r\n//~mult8 = Bus.audio(s, 1);\r\n//~mult9 = Bus.audio(s, 1);\r\n//~mult10 = Bus.audio(s, 1);\r\n//~mult11 = Bus.audio(s, 1);\r\n//~mult12 = Bus.audio(s, 1);\r\n//~mult13 = Bus.audio(s, 1);\r\n//~mult14 = Bus.audio(s, 1);\r\n)\r\n\r\n(\r\nSynthDef(\\ChuitoSpat14, { arg mult0 = 16, mult1 = 17, mult2 = 18,\r\n\tmult3 = 19, mult4 = 20, mult5 = 21, mult6 = 22,\r\n\tmult7 = 23, mult8 = 24, mult9 = 25, mult10 = 26,\r\n\tmult11 = 27, mult12 = 28, mult13 = 29, source = 34;\r\n\tvar out0 = 0, out1 = 1, out2 = 2, out3 = 3, out4 = 4, out5 = 5, out6 = 6, out7 = 7;\r\n\tvar out8 = 8, out9 = 9, out10 = 10, out11 = 11, out12 = 12, out13 = 13, out14 = 14;\r\n\tvar sig0, sig1, sig2, sig3, sig4, sig5, sig6, sig7, sig8, sig9, sig10, sig11, sig12, sig13, sig14;\r\n\tsig0 = (In.ar(mult0, 1) * In.ar(source, 1));\r\n\tsig1 = (In.ar(mult1, 1) * In.ar(source, 1));\r\n\tsig2 = (In.ar(mult2, 1) * In.ar(source, 1));\r\n\tsig3 = (In.ar(mult3, 1) * In.ar(source, 1));\r\n\tsig4 = (In.ar(mult4, 1) * In.ar(source, 1));\r\n\tsig5 = (In.ar(mult5, 1) * In.ar(source, 1));\r\n\tsig6 = (In.ar(mult6, 1) * In.ar(source, 1));\r\n\tsig7 = (In.ar(mult7, 1) * In.ar(source, 1));\r\n\tsig8 = (In.ar(mult8, 1) * In.ar(source, 1));\r\n\tsig9 = (In.ar(mult9, 1) * In.ar(source, 1));\r\n\tsig10 = (In.ar(mult10, 1) * In.ar(source, 1));\r\n\tsig11 = (In.ar(mult11, 1) * In.ar(source, 1));\r\n\tsig12 = (In.ar(mult12, 1) * In.ar(source, 1));\r\n\tsig13 = (In.ar(mult13, 1) * In.ar(source, 1));\r\n\tOut.ar(0, sig0);\r\n\tOut.ar(1, sig1);\r\n\tOut.ar(2, sig2);\r\n\tOut.ar(3, sig3);\r\n\tOut.ar(4, sig4);\r\n\tOut.ar(5, sig5);\r\n\tOut.ar(6, sig6);\r\n\tOut.ar(7, sig7);\r\n\tOut.ar(8, sig8);\r\n\tOut.ar(9, sig9);\r\n\tOut.ar(10, sig10);\r\n\tOut.ar(11, sig11);\r\n\tOut.ar(12, sig12);\r\n\tOut.ar(13, sig13);\r\n\t}).send(s);\r\n)\r\n\r\n\r\n(\r\n~g1 = 0.0;\r\n~g2 = 0.0;\r\n~g3 = 0.0;\r\n~g4 = 0.0;\r\n~g5 = 0.0;\r\n~g6 = 0.0;\r\n~g7 = 0.0;\r\n~g8 = 0.0;\r\n~g9 = 0.0;\r\n~g10 = 0.0;\r\n~g11 = 0.0;\r\n~g12 = 0.0;\r\n~g13 = 0.0;\r\n~g14 = 0.0;\r\nSynthDef(\\ElCubitodeChuito, {\r\nvar samplerate = 44100, sampx, sampy, sampz;\r\nvar x0 = 0.1, x1, y0, x2, logx, ampx;\r\nvar x00 = 0.1, x11, y00, x22, logy, ampy;\r\nvar x000 = 0.1, x111, y000, x222, logz, ampz;\r\nvar cvar0 = 3.8, cvar00/* = 3.99*/, cvar000;\r\nvar b0, b1, b2;\r\nvar brampx, brampy, brampz;\r\nvar buntx, bunty, buntz;\r\nvar maxsamp;\r\nvar int1, int2, int3, int4, int5, int6, int7, int8, int9, int10, int11, int12, int13, int14;\r\nvar x0x, y0x, y1x, ax;\r\nvar x0y, y0y, y1y, ay;\r\nvar x0z, y0z, y1z, az;\r\nvar speaker1x = 0.0, speaker1y = 1.0, speaker1z = 0.0, spik1, speaker1;//Left Back Up\r\nvar speaker2x = 1.0, speaker2y = 1.0, speaker2z = 0.0, spik2, speaker2;// Right Back Up\r\nvar speaker3x = 0.0, speaker3y = 1.0, speaker3z = 1.0, spik3, speaker3;// Left Front Up\r\nvar speaker4x = 1.0, speaker4y = 1.0, speaker4z = 1.0, spik4, speaker4;// Right Front UP\r\nvar speaker5x = 0.0, speaker5y = 0.0, speaker5z = 0.0, spik5, speaker5;// Left Back Down\r\nvar speaker6x = 1.0, speaker6y = 0.0, speaker6z = 0.0, spik6, speaker6;// Right Back Down\r\nvar speaker7x = 0.0, speaker7y = 0.0, speaker7z = 1.0, spik7, speaker7;// Left Front Down\r\nvar speaker8x = 1.0, speaker8y = 0.0, speaker8z = 1.0, spik8, speaker8;// Right Front Down\r\nvar speaker9x = 0.0, speaker9y = 0.5, speaker9z = 0.5, spik9, speaker9;// Center Left\r\nvar speaker10x = 1.0, speaker10y = 0.5, speaker10z = 0.5, spik10, speaker10;// Center Right\r\nvar speaker11x = 0.5, speaker11y = 0.5, speaker11z = 0.0, spik11, speaker11;// Center Back\r\nvar speaker12x = 0.5, speaker12y = 0.5, speaker12z = 1.0, spik12, speaker12;// Center Front\r\nvar speaker13x = 0.5, speaker13y = 1.0, speaker13z = 0.5, spik13, speaker13;// Center UP\r\nvar speaker14x = 0.5, speaker14y = 0.0, speaker14z = 0.5, spik14, speaker14;// Center Down\r\nvar nspeakers = 14;\r\nvar listeningthreshold, range = 0.5 /* 0.25 - 2/3 */;\r\nvar offsetx, offsety, offsetz;\r\nvar e = 2.7182818284590452353602874713527, width = 0.01; /*0.001 - > 0.09 */\r\nvar d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14;\r\nvar g1, g2, g3, g4;\r\nvar out1, out2, out3, out4;\r\n\r\n    b0 = LocalBuf(1);\r\n\tb1 = LocalBuf(1);\r\n\tb2 = LocalBuf(1);\r\n\r\n\tlisteningthreshold = 60;\r\n\r\n\t//\r\n\t// // Use any In.ar(....) here or any Bus from outside to produce the x coordinate from 0 to 1.\r\n\t//\r\n\t// For now is just a logistic function in order to produce an x coordinate path with the Logistic Map\r\n\r\n\tsampx = 0.5;\r\n\tcvar0 = 3.3;\r\n\tb0 = LocalBuf(1);\r\n\tx0 = Dbufrd(b0); // read from buffe\r\n\tx1 = (cvar0*(x0+0.00001)) * (1 - (x0+0.00001));\r\n\tx0 = x1;\r\n\ty0 = Dbufwr(x1, b0); // write to buffer\r\n\tlogx = Duty.ar(1/sampx, 0, (y0 * 0.5));\r\n\r\n    //\r\n\t// Use any In.ar(....) here or any Bus from outside to produce the y coordinate from 0 to 1.\r\n\t//\r\n\t// For now is just a logistic function in order to produce an x coordinate path with the Logistic Map\r\n\r\n\tsampy = sampx;\r\n\tcvar00 = 3.3;\r\n\tb1 = LocalBuf(1);\r\n\tx00 = Dbufrd(b1); // read from buffe\r\n\tx11 = (cvar00*(x00+0.00001)) * (1 - (x00+0.00001));\r\n\tx00 = x11;\r\n\ty00 = Dbufwr(x11, b1); // write to buffer\r\n\tlogy = Duty.ar(1/sampy, 0, y00);\r\n\r\n\t//\r\n\t// Use any In.ar(....) here or any Bus from outside to produce the z coordinate from 0 to 1.\r\n\t//\r\n\t// For now is just a logistic function in order to produce an z coordinate path with the Logistic Map\r\n\r\n\tsampz = sampx;\r\n\tcvar000 = 3.3;\r\n\tb2 = LocalBuf(1);\r\n\tx000 = Dbufrd(b2); // read from buffe\r\n\tx111 = (cvar000*(x000+0.00001)) * (1 - (x000+0.00001));\r\n\tx000 = x111;\r\n\ty000 = Dbufwr(x111, b2); // write to buffer\r\n\tlogz = Duty.ar(1/sampz, 0, y000);\r\n\r\n\t// Distance Formula\r\n\r\n\tint1 = Ramp.ar(((((logx-speaker1x)**2)+((logy - speaker1y)**2)+((logz - speaker1z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint2 = Ramp.ar(((((logx-speaker2x)**2)+((logy - speaker2y)**2)+((logz - speaker2z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint3 = Ramp.ar(((((logx-speaker3x)**2)+((logy - speaker3y)**2)+((logz - speaker3z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint4 = Ramp.ar(((((logx-speaker4x)**2)+((logy - speaker4y)**2)+((logz - speaker4z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint5 = Ramp.ar(((((logx-speaker5x)**2)+((logy - speaker5y)**2)+((logz - speaker5z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint6 = Ramp.ar(((((logx-speaker6x)**2)+((logy - speaker6y)**2)+((logz - speaker6z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint7 = Ramp.ar(((((logx-speaker7x)**2)+((logy - speaker7y)**2)+((logz - speaker7z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint8 = Ramp.ar(((((logx-speaker8x)**2)+((logy - speaker8y)**2)+((logz - speaker8z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint9 = Ramp.ar(((((logx-speaker9x)**2)+((logy - speaker9y)**2)+((logz - speaker9z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint10 = Ramp.ar(((((logx-speaker10x)**2)+((logy - speaker10y)**2)+((logz - speaker10z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint11 = Ramp.ar(((((logx-speaker11x)**2)+((logy - speaker11y)**2)+((logz - speaker11z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint12 = Ramp.ar(((((logx-speaker12x)**2)+((logy - speaker12y)**2)+((logz - speaker12z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint13 = Ramp.ar(((((logx-speaker13x)**2)+((logy - speaker13y)**2)+((logz - speaker13z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\tint14 = Ramp.ar(((((logx-speaker14x)**2)+((logy - speaker14y)**2)+((logz - speaker14z)**2)).sqrt).linlin(0.0,1.7320508075689,0.0,1.0),1/sampx);\r\n\r\n\r\n\t//The one liner for amplitude distribution in space concerning distance.\r\n\r\n\td1 = (((if(int1 > range, 0, if(int1>(range*0.5),(1-int1.linlin(0.0,range,0.0,1.0))**(1/2), (int1.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td2 = (((if(int2 > range, 0, if(int2>(range*0.5),(1-int2.linlin(0.0,range,0.0,1.0))**(1/2), (int2.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td3 = (((if(int3 > range, 0, if(int3>(range*0.5),(1-int3.linlin(0.0,range,0.0,1.0))**(1/2), (int3.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td4 = (((if(int4 > range, 0, if(int4>(range*0.5),(1-int4.linlin(0.0,range,0.0,1.0))**(1/2), (int4.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td5 = (((if(int5 > range, 0, if(int5>(range*0.5),(1-int5.linlin(0.0,range,0.0,1.0))**(1/2), (int5.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td6 = (((if(int6 > range, 0, if(int6>(range*0.5),(1-int6.linlin(0.0,range,0.0,1.0))**(1/2), (int6.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td7 = (((if(int7 > range, 0, if(int7>(range*0.5),(1-int7.linlin(0.0,range,0.0,1.0))**(1/2), (int7.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td8 = (((if(int8 > range, 0, if(int8>(range*0.5),(1-int8.linlin(0.0,range,0.0,1.0))**(1/2), (int8.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td9 = (((if(int9 > range, 0, if(int9>(range*0.5),(1-int9.linlin(0.0,range,0.0,1.0))**(1/2), (int9.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td10 = (((if(int10 > range, 0, if(int10>(range*0.5),(1-int10.linlin(0.0,range,0.0,1.0))**(1/2), (int10.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td11 = (((if(int11 > range, 0, if(int11>(range*0.5),(1-int11.linlin(0.0,range,0.0,1.0))**(1/2), (int11.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td12 = (((if(int12 > range, 0, if(int12>(range*0.5),(1-int12.linlin(0.0,range,0.0,1.0))**(1/2), (int12.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td13 = (((if(int13 > range, 0, if(int13>(range*0.5),(1-int13.linlin(0.0,range,0.0,1.0))**(1/2), (int13.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\td14 = (((if(int14 > range, 0, if(int14>(range*0.5),(1-int14.linlin(0.0,range,0.0,1.0))**(1/2), (int14.linlin(0.0,range,0.0,1.0))))).linlin(0.0,0.5, 0.0,1)));\r\n\r\n\r\n\t//// Just the Line\r\n\r\n\t~g1 = Out.ar(16,d1);\r\n\t~g2 = Out.ar(17,d2);\r\n\t~g3 = Out.ar(18,d3);\r\n\t~g4 = Out.ar(19,d4);\r\n\t~g5 = Out.ar(20,d5);\r\n\t~g6 = Out.ar(21,d6);\r\n\t~g7 = Out.ar(22,d7);\r\n\t~g8 = Out.ar(23,d8);\r\n\t~g9 = Out.ar(24,d9);\r\n\t~g10 = Out.ar(25,d10);\r\n\t~g11 = Out.ar(26,d11);\r\n\t~g12 = Out.ar(27,d12);\r\n\t~g13 = Out.ar(28,d13);\r\n\t~g14 = Out.ar(29,d14);\r\n\r\n\r\n\r\n\t/// Gaussian Curve\r\n\t// Optional Gaussian Curve if the perception of the distance is to linear or non natural. Open for musical expression\r\n\t// depending on the behaviour one wants. You can use other envelopes to distribute the amplitude in space regarding\r\n\t// your musical, perceptive, or research reason.\r\n\t//\r\n\t//Use the variables to produce the window depnding on the width of the funtion and its amplitude\r\n\r\n\t//\r\n\t// ~g1 = Out.ar(16,((2.5/(1*(2pi).sqrt))*(e**((((d1-0.5)**2)/((2*width)**2))* (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g2 = Out.ar(17,((2.5/(1*(2pi).sqrt))*(e**((((d2-0.5)**2)/((2*width)**2))* (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g3 = Out.ar(18,((2.5/(1*(2pi).sqrt))*(e**((((d3-0.5)**2)/((2*width)**2))* (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g4 = Out.ar(19,((2.5/(1*(2pi).sqrt))*(e**((((d4-0.5)**2)/((2*width)**2))* (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g5 = Out.ar(20,((2.5/(1*(2pi).sqrt))*(e**((((d5-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g6 = Out.ar(21,((2.5/(1*(2pi).sqrt))*(e**((((d6-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g7 = Out.ar(22,((2.5/(1*(2pi).sqrt))*(e**((((d7-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g8 = Out.ar(23,((2.5/(1*(2pi).sqrt))*(e**((((d8-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g9 = Out.ar(24,((2.5/(1*(2pi).sqrt))*(e**((((d9-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g10 = Out.ar(25,((2.5/(1*(2pi).sqrt))*(e**((((d10-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g11 = Out.ar(26,((2.5/(1*(2pi).sqrt))*(e**((((d11-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g12 = Out.ar(27,((2.5/(1*(2pi).sqrt))*(e**((((d12-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g13 = Out.ar(28,((2.5/(1*(2pi).sqrt))*(e**((((d13-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\t// ~g14 = Out.ar(29,((2.5/(1*(2pi).sqrt))*(e**((((d14-0.5)**2)/((2*width)**2))*\r\n\t// (-1)))).linlin(0.0,1.0,0.0,0.9));\r\n\r\n    /// Sine curve y otros\r\n\r\n};\r\n).add;\r\n)\r\n\r\n~noise = {Out.ar(34,WhiteNoise.ar(0.5))}.play\r\n\r\n~spat = Synth(\\ChuitoSpat14);\r\n\r\n~xyz = Synth(\\ElCubitodeChuito)",
   "id" : "1-50V",
   "is_private" : null,
   "name" : "El Cubito de Chuito by Roy Fernando Guzmán, 3d Sound using Liminal Spatialization System.",
   "author" : "Roy F Guzmán",
   "ancestor_list" : [],
   "description" : "This code is using Duty UGens in order to produce a SynthDefs to spatialize sound in 3d with out creating Classes."
}
