SuperCollider code for 8-channel composition exhibited in 2020 at Steklenik gallery run by CONA institute.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

129 lines
3.2 KiB

  1. (
  2. // a function to position sound in space
  3. ~octoPanOut = {
  4. arg in, in_x, in_y, fact;
  5. var s1_x=0, s1_y=0, s1_amp,
  6. s2_x=0, s2_y=360, s2_amp,
  7. s3_x=0, s3_y=720, s3_amp,
  8. s4_x=0, s4_y=1080, s4_amp,
  9. s5_x=650, s5_y=1260, s5_amp,
  10. s6_x=650, s6_y=900, s6_amp,
  11. s7_x=650, s7_y=540, s7_amp,
  12. s8_x=650, s8_y=180, s8_amp ;
  13. var factor = (1 / (5000000 * fact)); // exponential curve of amplification calculated from distance? log????
  14. //var distance = {|x1,y1,x2,y2| ((x2-x1).squared + (y2-y1).squared).sqrt};
  15. var distance = {|x1,y1,x2,y2| (x2-x1) hypot: (y2-y1) }; // hypothenuse
  16. var amp = 1 / (1 + (distance.cubed * factor));
  17. //in_x = (in_x + 1) * 0.5 * 650;
  18. in_x = in_x * 650;
  19. //in_y = (in_y + 1) * 0.5 * 1260;
  20. in_y = in_y * 1260;
  21. s1_amp = amp.value(in_x,in_y,s1_x,s1_y);
  22. s2_amp = amp.value(in_x,in_y,s2_x,s2_y);
  23. s3_amp = amp.value(in_x,in_y,s3_x,s3_y);
  24. s4_amp = amp.value(in_x,in_y,s4_x,s4_y);
  25. s5_amp = amp.value(in_x,in_y,s5_x,s5_y);
  26. s6_amp = amp.value(in_x,in_y,s6_x,s6_y);
  27. s7_amp = amp.value(in_x,in_y,s7_x,s7_y);
  28. s8_amp = amp.value(in_x,in_y,s8_x,s8_y);
  29. [in * s1_amp, in * s2_amp, in * s3_amp, in * s4_amp, in * s5_amp, in * s6_amp, in * s7_amp, in * s8_amp]
  30. };
  31. SynthDef("octoPanner", {
  32. arg inBus, x=0, y=0.14, radius=1, outBus;
  33. var snd = In.ar(inBus,1);
  34. snd = ~octoPanOut.value(snd, x, y, radius);
  35. Out.ar(outBus, snd);
  36. }).add;
  37. );
  38. (
  39. SynthDef("reverBusser", {
  40. arg inBus, outBus, verb1wet=0, verb2wet=0, verb3wet=0, verb4wet=0;
  41. var verb1, verb2, verb3, verb4;
  42. var snd = In.ar(inBus, 8);
  43. snd.put(0, Limiter.ar(in:snd.at(0), level:-6.dbamp, dur:0.04));
  44. snd.put(1, Limiter.ar(in:snd.at(1), level:-6.dbamp, dur:0.04));
  45. snd.put(2, Limiter.ar(in:snd.at(2), level:-6.dbamp, dur:0.04));
  46. snd.put(3, Limiter.ar(in:snd.at(3), level:-6.dbamp, dur:0.04));
  47. snd.put(4, Limiter.ar(in:snd.at(4), level:-6.dbamp, dur:0.04));
  48. snd.put(5, Limiter.ar(in:snd.at(5), level:-6.dbamp, dur:0.04));
  49. snd.put(6, Limiter.ar(in:snd.at(6), level:-6.dbamp, dur:0.04));
  50. snd.put(7, Limiter.ar(in:snd.at(7), level:-6.dbamp, dur:0.04));
  51. verb1 = JPverb.ar(snd.at([0,1]) * verb1wet);
  52. verb2 = JPverb.ar(snd.at([2,3]) * verb2wet);
  53. verb3 = JPverb.ar(snd.at([4,5]) * verb3wet);
  54. verb4 = JPverb.ar(snd.at([6,7]) * verb4wet);
  55. snd.put(0, snd.at(0) + verb1.at(0) );
  56. snd.put(1, snd.at(1) + verb1.at(1) );
  57. snd.put(2, snd.at(2) + verb2.at(0) );
  58. snd.put(3, snd.at(3) + verb2.at(1) );
  59. snd.put(4, snd.at(4) + verb3.at(0) );
  60. snd.put(5, snd.at(5) + verb3.at(1) );
  61. snd.put(6, snd.at(6) + verb4.at(0) );
  62. snd.put(7, snd.at(7) + verb4.at(1) );
  63. Out.ar(outBus, snd);
  64. }).add;
  65. );
  66. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  67. // pseudo-UGen proposition by 'elgiano'
  68. // https://scsynth.org/t/simple-spatialisation-function-synthdef-pseudo-ugen-or-ugen/1783/5
  69. /*
  70. OctoPan : MultiOutUGen {
  71. classvar <>speakers = #[
  72. [0,0],[0,360],[0,720],[0,1080],[650,1260],[650,900],[650,540],[650,180]
  73. ];
  74. *ar { arg in,x=0,y=0,speakers;
  75. ^this.multiNew('audio', in,x,y);
  76. }
  77. *new1 { arg rate,in,x,y;
  78. var amps = this.speakers.collect{|coords|
  79. var dist = coords - [x,y];
  80. 1/(1+dist[0].hypot(dist[1]))
  81. };
  82. ^in*amps;
  83. }
  84. }
  85. */