Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.59 KB | None | 0 0
  1. (
  2. //init/cleanup
  3. s.newBusAllocators;
  4. ~vbus = Bus.audio(s, 2);
  5. s.freeAll;
  6. ~players.do(_.stop);
  7.  
  8. s.waitForBoot({
  9.  
  10. //fm synth
  11. SynthDef(\fm, {
  12. arg freq=500, mRatio=1, cRatio=1,
  13. index=1, iScale=5, cAtk=4, cRel=(-4),
  14. amp=0.2, atk=0.01, rel=3, pan=0,
  15. out=0, fx=0, fxsend=(-25);
  16. var car, mod, env, iEnv;
  17.  
  18. //index of modulation
  19. iEnv = EnvGen.kr(
  20. Env(
  21. [index, index*iScale, index],
  22. [atk, rel],
  23. [cAtk, cRel]
  24. )
  25. );
  26.  
  27. //amplitude envelope
  28. env = EnvGen.kr(Env.perc(atk,rel,curve:[cAtk,cRel]),doneAction:2);
  29.  
  30. //modulator/carrier
  31. mod = SinOsc.ar(freq * mRatio, mul:freq * mRatio * iEnv);
  32. car = SinOsc.ar(freq * cRatio + mod) * env * amp;
  33.  
  34. car = Pan2.ar(car, pan);
  35.  
  36. //direct out/reverb send
  37. Out.ar(out, car);
  38. Out.ar(fx, car * fxsend.dbamp);
  39. }).add;
  40.  
  41. //reverb
  42. SynthDef(\reverb, {
  43. arg in=0, out=0, dec=4, lpf=1500;
  44. var sig;
  45. sig = In.ar(in, 2).sum;
  46. sig = DelayN.ar(sig, 0.03, 0.03);
  47. sig = CombN.ar(sig, 0.1, {Rand(0.01,0.099)}!32, dec);
  48. sig = SplayAz.ar(2, sig);
  49. sig = LPF.ar(sig, lpf);
  50. 5.do{sig = AllpassN.ar(sig, 0.1, {Rand(0.01,0.099)}!2, 3)};
  51. sig = LPF.ar(sig, lpf);
  52. sig = LeakDC.ar(sig);
  53. Out.ar(out, sig);
  54. }).add;
  55.  
  56. s.sync;
  57.  
  58. Synth(\reverb, [\in, ~vbus]);
  59.  
  60. s.sync;
  61.  
  62. //array of sequencers
  63. ~players = [
  64.  
  65. //bass
  66. Pbind(
  67. \instrument, \fm,
  68. \dur, 1/6,
  69. \midinote, Pseq([
  70. Pseq([[28,40]],32),
  71. Pseq([[24,36]],24), Pseq([[33,45]],8),
  72. ],inf) + Pwrand([0,12],[0.9,0.1],inf),
  73. \mRatio, 2,
  74. \index, 1.5,
  75. \iScale, Pseq([3,2.5,2,1],inf),
  76. \atk, 0,
  77. \rel, Pexprand(0.2,0.4,inf),
  78. \amp, Pseq([Pgeom(0.28,-3.dbamp,4)],inf),
  79. \pan, Pseq([-0.25,0.25],inf),
  80. \out, 0,
  81. \fx, ~vbus,
  82. \fxsend, -20,
  83. ).play,
  84.  
  85. //lead
  86. Pbind(
  87. \instrument, \fm,
  88. \dur, 1/6,
  89. \midinote, Pseq([Pfin(64, Pseq([64,67,69,71,74,76],inf))],inf),
  90. \mRatio, Pwrand([0.5,1.5,2,3],[1,3,6,25].normalizeSum, inf),
  91. \index, Pexprand(2,2.5),
  92. \iScale, Pseq([Pgeom(1.2,1.2,6)],inf),
  93. \atk, Pwrand([0,Pexprand(0.02,0.1,1)],[0.99,0.01],inf),
  94. \rel, Pseq(Array.interpolation(64,0.03,0.25).mirror2,inf),
  95. \cAtk, 1,
  96. \cRel, Pseq(Array.interpolation(64,-4,3).mirror2,inf),
  97. \amp, Pseq([Pfin(64, Pseq([Pgeom(0.13,-3.dbamp,6)],inf))],inf),
  98. \pan, Pseq(Array.interpolation(64,0,1).lincurve(0,1,0,1,8),inf) * Pseq([1,-1],inf),
  99. \out, 0,
  100. \fx, ~vbus,
  101. \fxsend, -15,
  102. ).play,
  103.  
  104. //pad
  105. Pbind(
  106. \instrument, \fm,
  107. \dur, 1/6 * 32,
  108. \midinote, Pseq([
  109. [40,52,57,59,62],
  110. [40,55,57,59,64],
  111. [40,52,57,59,62],
  112. [33,45,57,59,64],
  113. ],inf),
  114. \mRatio, 1,
  115. \index, 1.5,
  116. \iScale, Pseq([2,4],inf),
  117. \atk, 1/6 * 16,
  118. \rel, 1/6 * 24,
  119. \cAtk, 0,
  120. \cRel, 0,
  121. \amp, 0.027,
  122. \out, 0,
  123. \fx, ~vbus,
  124. \fxsend, -10,
  125. ).play,
  126.  
  127. //snare
  128. Pbind(
  129. \instrument, \fm,
  130. \dur, 1/6,
  131. \freq, Pseq([
  132. \,\,\,\,1,\,\,\,
  133. \,\,\,\,1,\,\,\,
  134. \,\,\,\,1,\,\,\,
  135. \,\,\,\,1,\,\,1,
  136. \,\,\,\,1,\,\,\,
  137. \,\,\,\,1,\,\,\,
  138. \,\,\,\,1,\,\,\,
  139. \,\,\,\,1,1,1,1,
  140. ],inf) * 411,
  141. \cRatio, 45.9,
  142. \mRatio, 1.5,
  143. \index, 100,
  144. \iScale, 1,
  145. \atk, 0,
  146. \rel, 0.1,
  147. \cRel, -8,
  148. \amp, Pseq([0.18,0.04,0.18,0.1],inf),
  149. \pan, 0,
  150. \out, 0,
  151. \fx, ~vbus,
  152. \fxsend, -12,
  153. ).play,
  154.  
  155. //kick
  156. Pbind(
  157. \instrument, \fm,
  158. \dur, 1/6,
  159. \freq, 25,
  160. \mRatio, 0.4,
  161. \index, 2,
  162. \iScale, 8,
  163. \atk, 0,
  164. \rel, 0.08,
  165. \amp, Pseq([Pgeom(0.8,-2.dbamp,8)],inf),
  166. \pan, Pseq([0.3,-0.3],inf),
  167. \out, 0,
  168. \fx, ~vbus,
  169. \fxsend, -16,
  170. ).play
  171. ];
  172. });
  173. )
  174.  
  175. //stop
  176. ~players.do(_.stop);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement