A place to dump little or mid-sized snippets of SuperCollider code.
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.

59 lines
1.4KB

  1. ( // basic synth SynthDef
  2. SynthDef(\blipo, { | out, freq = 440, amp = 0.1, nharms = 10, pan = 0, gate = 1, sustain, attack=0.1 |
  3. var audio = Blip.ar(freq * (SinOsc.kr(3).range(1,1.01)), nharms, amp);
  4. var env = Linen.kr(gate, attackTime: attack, releaseTime: sustain, doneAction: Done.freeSelf);
  5. OffsetOut.ar(out, Pan2.ar(audio, pan, env) );
  6. }).add;
  7. // reverb effect SynthDef
  8. SynthDef("reverbo", { arg outBus = 0, inBus, wet = 0.1;
  9. var input = In.ar(inBus,2);
  10. var rev = JPverb.ar(input * wet, t60:6, damp:0.5);
  11. Out.ar(outBus, input + (rev));
  12. }).add;
  13. )
  14. // create a 'private' 2-chan audio bus
  15. ~revbus = Bus.audio(s,2);
  16. (
  17. // start reverb effect on the private bus
  18. ~fxRev = Synth("reverbo", [\inBus, ~revbus, \wet, 0.9]);
  19. ~dotsP = Pbind(
  20. \dur, Pflatten(1, Plorenz() * 1),
  21. \attack, 0.01,
  22. \octave, 3,
  23. \nharms, Prand((2..7),500) );
  24. ~linesP = Pbind(
  25. \dur, Pflatten(1, Plorenz() * 5),
  26. \attack, 3,
  27. \octave, Prand([2,3,4],inf),
  28. \nharms, Prand((1..4),80),
  29. \amp, 0.075 );
  30. ~highP = Pbind(
  31. \dur, Pflatten(1, Plorenz() * 5),
  32. \attack, 3,
  33. \octave, 5,
  34. \nharms, Prand((1..3),50),
  35. \amp, 0.008 );
  36. Pbindf(
  37. Ptpar([ 0, ~dotsP, 60, ~linesP, 160, ~highP]),
  38. \instrument, \blipo,
  39. \degree, (Pflatten(1, Plorenz()) * 18).asInteger,
  40. \mtranspose, Prand([Pn(0,24),Pn(2,24),Pn(4,24)], inf),
  41. \detune, Prand([0,1,0.5,1.5], inf),
  42. \scale, Scale.minor(\just),
  43. \legato, Prand((4..7),inf) * 0.2,
  44. \pan, Prand((-10..10),inf) * 0.1,
  45. \out, ~revbus
  46. ).play;
  47. )