SHARE
TWEET

2018-07-30

clacktron Jul 30th, 2018 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (
  2. SynthDef(\test, {
  3.     arg t_trig = 1,
  4.         freq = 200,
  5.         gain = 0.5,
  6.         amp = 1,
  7.         pan = 0,
  8.         totalDecay = 0.25;
  9.  
  10.     var decay = 0.25 * totalDecay;
  11.     var noiseEnv = EnvGen.ar(Env.perc(0.01, decay, gain, -5), t_trig);
  12.     var ringDecay = decay * 2;
  13.     var ampEnv = EnvGen.ar(Env.asr(releaseTime: ringDecay), t_trig, doneAction: 2);
  14.     var noise = PinkNoise.ar(noiseEnv);
  15.     var resFreqs = [freq, freq+500, freq+600, freq+1000];
  16.     var resAmps = [5, 1, 1, 1].normalizeSum * 0.095;
  17.     var resRings = [ringDecay, ringDecay * 0.75, ringDecay * 0.5, ringDecay * 0.6];
  18.     var klank = DynKlank.ar(`[
  19.         resFreqs,
  20.         resAmps,
  21.         resRings
  22.     ], noise);
  23.     var out = Pan2.ar(klank, pan, amp);
  24.  
  25.     Out.ar(0, out);
  26.  
  27. }).add;
  28.  
  29. SynthDef(\kick, {
  30.     arg t_trig = 1,
  31.         freq = 40,
  32.         punch = 0.05,
  33.         decay = 0.45,
  34.         amp = 0.5;
  35.  
  36.     var env = EnvGen.kr(Env.perc(0.01, decay), t_trig, doneAction: 2);
  37.     var freqenv = EnvGen.kr(Env.perc(0.01, punch));
  38.     var synth = SinOsc.ar(freq + (freqenv * 200), 0, env);
  39.  
  40.     Out.ar([0,1], synth * amp);
  41. }).add;
  42. )
  43.  
  44. (
  45. Pdef(\testPatt, {
  46.  
  47.     Pbind(
  48.         \instrument, \test,
  49.         \degree, Pwrand(#[-6, -3, -1, 0, 4], #[10, 6, 3, 3, 10].normalizeSum, inf),
  50.         \scale, Scale.at('minor'),
  51.         \trig, 1,
  52.         \amp, 0.3,
  53.         \decay, Pwrand(
  54.             #[0.25, 0.5, 0.75, 1, 1.5],
  55.             #[5, 4, 3, 2, 1].normalizeSum,
  56.             inf
  57.         ),
  58.         \delta, Pwrand(
  59.             #[0.5, 1, 1.5, 2],
  60.             #[3, 3, 2, 1].normalizeSum,
  61.             inf
  62.         )
  63.     );
  64.  
  65. }).stop;
  66. )
  67.  
  68. (
  69. Pdef(\kickPatt, {
  70.     Pbind(
  71.         \instrument, \kick,
  72.         \freq, 40,
  73.         \punch, 0.1,
  74.         \amp, 0.4,
  75.         \trig, 1,
  76.         \delta, Prand(#[1, 1.5, 2], inf)
  77.     );
  78. }).stop;
  79. )
  80.  
  81. TempoClock.default.tempo = 132/30;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top