Smol or mid-sized snippets of SuperCollider code that start in SuperCollider's Workspace Emacs buffer from scratch.
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.

113 lines
3.2 KiB

  1. // =====================================================================
  2. // SuperCollider Workspace 20.FEB 2021
  3. // =====================================================================
  4. (
  5. Server.default.waitForBoot { fork {
  6. ~revBus.free;
  7. ~revFx.free;
  8. s.sync;
  9. ~revBus = Bus.audio(s, 2);
  10. SynthDef(\bet, { |gate = 1, freq = 234, out = 0, pan = 0, amp = 0.1, cutoff = 4000 |
  11. var snd, env, fenv;
  12. freq = [freq, freq * 1.01] * Rand(0.995, 1.0);
  13. freq = freq * SinOsc.kr(5).range(0.99, 1.01);
  14. env = EnvGen.ar(Env.asr(0, 1, 3), gate, doneAction:2);
  15. fenv = EnvGen.ar(Env.adsr(0.05, 0.5, 0.4, 2), gate);
  16. snd = SinOsc.ar(freq);
  17. snd = snd + Pulse.ar(freq * 0.5, mul:0.8);
  18. snd = snd + LFTri.ar(freq * [1,2].choose * 1.01, mul:1);
  19. snd = LPF.ar(snd, cutoff * fenv + 100);
  20. snd = snd * env * amp;
  21. snd = Balance2.ar(snd[0], snd[1], pan, 0.7);
  22. Out.ar(out, snd);
  23. }).add;
  24. SynthDef(\revfx, { |inBus, outBus = 0, wet = 0.3, amp = 0.2|
  25. var snd, rev;
  26. snd = In.ar(inBus, 2);
  27. snd = BHiShelf.ar(snd, 5000, db:-3);
  28. rev = GVerb.ar(snd, 100, taillevel:wet);
  29. rev = rev * amp;
  30. Out.ar(outBus, rev);
  31. }).add;
  32. s.sync;
  33. ~revFx = Synth(\revfx, [\inBus, ~revBus, \amp, 0.4, \wet, 0.4], addAction:\addAfter);
  34. s.sync;
  35. Pbindef(\betP, *[
  36. instrument: \bet,
  37. dur: Prand((1..10), inf) * 0.03 + 1/4 * 0.8,
  38. // from Ichika Nito - Arpeggio //
  39. note: Pseq([
  40. -3, 13, 15, 20, 16, Rest(), // Dbm(add9)/A
  41. -3, 12, 18, 23, 16, Rest(), // Am69
  42. -4, 6, 11, 15, 16, Rest(), // EM9/Ab
  43. -4, 6, 13, 15, 16, Rest(), // Ab7sus4(-13(
  44. -6, 6, 9, 13, 20, Rest(), // Gbm(add9)
  45. -4, 8, 12, 18, 16, Rest(), // Abaug7
  46. 1, 13, 15, 20, 16, Rest(), // Dbm(add9)
  47. -1, 11, 15, 20, 16, Rest(), // EM7/B
  48. -3, 13, 15, 20, 16, Rest(), // Dbm(add9)/A
  49. -3, 12, 18, 23, 25, Rest(), // Gbsus4(+11)/A
  50. -6, 6, 9, 13, 20, Rest(), // Gbm(add9)
  51. -4, 3, 6, 11, 15, 20, // Abm7 // 12*6
  52. ], inf),
  53. octave: Pseq([
  54. Prand([[5,4],[5,6],[4,5,6]]),
  55. Pn(Pwrand([5,6],[0.7,0.3]), 5)
  56. ], inf),
  57. legato: Pseq([4, Pn(Prand((2..5)*0.2),5)],inf),
  58. cutoff: Prand((1..4),inf) *
  59. Pseg([50, 1000, 1000, 50, 10], [60, 60, 30, 20], \cub),
  60. amp: Pseg([0, 0.1, 0.1, 0.01, 0], [10, 120, 30, 10], \cub),
  61. out: ~revBus,
  62. pan: Prand((0..10)-5*0.1, inf)
  63. ]).play
  64. }}
  65. )
  66. // notes:
  67. /*
  68. // Db Eb Fb E# Gb Ab Bb Cb
  69. // C C# D D# E F F# G G# A A# B C
  70. // 0 1 2 3 4 5 6 7 8 9 10 11 12
  71. // guitar strings
  72. // E A D G B E
  73. // -8 -3 2 7 11 16
  74. // guitar strings
  75. // E A D G B E
  76. // -8, -3, 2, 7, 11, 16
  77. // taken from Ichika Nito - Arpeggio
  78. -3, 2+11, 7+8, 11+9, 16, Rest(), // Dbm(add9)/A
  79. -3, 2+10, 7+11, 11+12, 16, Rest(), // Am69
  80. -8+4, 2+4, 7+4, 11+4, 16 , Rest(), // EM9/Ab
  81. -8+4, 2+4, 7+6, 11+4, 16 , Rest(), // Ab7sus4(-13(
  82. -8+2, 2+4, 7+2, 11+2, 16+4, Rest(), // Gbm(add9)
  83. -8+4, 2+6, 7+5, 11+7, 16, Rest(), // Abaug7
  84. -8+9, 2+11, 7+8, 11+9, 16, Rest(), // Dbm(add9)
  85. -8+7, 2+9, 7+8, 11+9, 16, Rest(), // EM7/B
  86. -3, 2+11, 7+8, 11+9, 16, Rest(), // Dbm(add9)/A
  87. -3, 2+10, 7+11, 11+12, 16+9, Rest(), // Gbsus4(+11)/A
  88. -8+4, -3+6, 2+4, 7+4, 11+4, 16+4, // Abm7
  89. */