Complete SuperCollider code for smol two-track EP released in may 2021.
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.

168 lines
3.5 KiB

2 months ago
  1. (
  2. /* *******************************************************************
  3. Grenel Cycles (Limbo For Corrupt Politicians)
  4. copyright 2021 by Luka Prinčič
  5. distribution and re-use allowed under conditions of PP:BY-SA-NC
  6. (Peer Production: Attribution - ShareAlike - NonCapitalist) Licence
  7. ****************************************************************** */
  8. s.waitForBoot({
  9. fork({
  10. "-----------------------------------------".postln;
  11. // buffers/samples --
  12. ~b1 = Buffer.read(s, PathName.new(thisProcess.nowExecutingPath).pathOnly +/+ "pe4enkata_beatbox.wav");
  13. ~b2 = Buffer.read(s, PathName.new(thisProcess.nowExecutingPath).pathOnly +/+ "pe4enkata_diggity.wav");
  14. s.sync;
  15. // busses --
  16. ~revBus = Bus.audio(s, 2);
  17. ~dlyBus = Bus.audio(s, 2);
  18. s.sync;
  19. // syntdefs --
  20. SynthDef(\grenel, {
  21. arg outBus = 0, gate = 1, amp = 0.1, buf, pos = 0, atk = 1, rls = 1, rand = 0, frq = 0.1, rate = 1, ffreq = 450;
  22. var snd, gfreq = 200;
  23. snd = GrainBuf.ar(
  24. numChannels: 2,
  25. trigger: Impulse.ar(gfreq * LFNoise0.ar(gfreq).range(1, 0.8) ),
  26. dur: 0.2,
  27. sndbuf: buf,
  28. rate: rate,
  29. pos:
  30. ( LFNoise1.kr(frq).range(0,0.2) * rand ) +
  31. ( SinOsc.kr(frq).range(0,0.03) * (rand-1).abs )
  32. + pos
  33. * LFNoise0.ar(gfreq).range(1, 0.999), // rand position a bit
  34. pan: LFNoise1.ar(0.5) * 0.5
  35. );
  36. snd = LPF.ar(in: snd, freq: LFNoise1.ar(0.1).exprange(ffreq,15000));
  37. snd = snd * EnvGen.kr(Env([0,1,0], [atk,rls], [3,-3], 1), gate, doneAction:Done.freeSelf);
  38. snd = snd * amp;
  39. Out.ar(outBus, snd);
  40. }).add;
  41. SynthDef(\revfx,
  42. {
  43. arg inBus, outBus, amp=1, revtime=10;
  44. var input, snd;
  45. input = In.ar(inBus, 2);
  46. snd = GVerb.ar(input.sum, 100, revtime, drylevel:0, mul:-6.dbamp, add:input);
  47. snd = snd * amp;
  48. Out.ar(outBus, snd);
  49. }
  50. ).add;
  51. SynthDef(\dlyfx,
  52. {
  53. arg inBus, outBus, amp=1, dry=1, wet= -8.dbamp;
  54. var input, snd;
  55. input = In.ar(inBus, 2);
  56. snd = input * dry + CombN.ar(input, 1, [0.33,0.44], 5, mul:wet);
  57. snd = snd * amp;
  58. Out.ar(outBus, snd);
  59. }
  60. ).add;
  61. s.sync;
  62. // reverb
  63. ~revfx = Synth(\revfx, [\inBus, ~revBus, \outBus, 0, \amp, -5.dbamp], addAction:\addToTail);
  64. // delay fx
  65. ~dlyfx = Synth(\dlyfx, [\inBus, ~dlyBus, \outBus, 0, \amp, -5.dbamp], addAction:\addToTail);
  66. s.sync;
  67. Pbind(*[ // GRANULATOR 1
  68. instrument:\grenel,
  69. pos: Pseq([ // a certain sequence. a love.
  70. Pn(0.5, 2),
  71. [0.5,0.4],
  72. Pn([0.4], 2),
  73. [0.4,0.6],
  74. Pn([0.6], 2),
  75. [0.6,0.24],
  76. Pn([0.24], 2),
  77. [0.72, 0.24],
  78. Pn([0.72], 2),
  79. [0.7, 0.72],
  80. Pn([0.7], 2),
  81. [0.55, 0.7],
  82. Pn([0.55], 2),
  83. [0.75, 0.55],
  84. Pn([0.75], 2),
  85. [0.66, 0.75],
  86. Pn([0.66], 2),
  87. [0.11, 0.66],
  88. Pn([0.11], 2),
  89. [0.5, 0.11], // 30 * 30sec = 15min
  90. Pn([0.5], 2), // 1 min
  91. ]),
  92. rate: [0.25, 0.5, 1],
  93. dur: 30,
  94. legato:0.95,
  95. atk: 4,
  96. rls: 10,
  97. buf: ~b2,
  98. amp: -15.dbamp,
  99. outBus: ~revBus,
  100. // debug:
  101. postln: Pfunc({arg e; postln("G1 pos:" + e.pos)})
  102. ]).play;
  103. Pbind(*[ // GRANULATOR 2
  104. instrument:\grenel,
  105. pos: Pwhite(0.1,0.9),
  106. rate: [0.5,1,1],
  107. ffreq: 9000,
  108. dur: Pseq([Rest(6 * 30), Pn(Pseq([Rest(30), 30]), 32-6)]),
  109. legato:1,
  110. atk: 7,
  111. rls: 0.1,
  112. buf: ~b1,
  113. rand: Pwhite(0.1, 1, 32-5),
  114. frq: Prand([1, 1/2, 1/4], inf),
  115. amp:-26.dbamp,
  116. outBus: ~dlyBus,
  117. // debug:
  118. postln: Pfunc(
  119. {
  120. arg e;
  121. postln("G2 pos:"
  122. + e.pos.round(0.01)
  123. + " rand:"
  124. + e.rand.round(0.01)
  125. + " dur:"
  126. + e.dur
  127. + " frq:"
  128. + e.frq)
  129. })
  130. ]).play;
  131. })
  132. })
  133. )