clacktron

Untitled

Mar 17th, 2018
314
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (
  2. SynthDef(\kick, { |out = 0, tune = 30, decay = 0.5, curve = -6, punch = 0.5, t_trig = 1, amp = 0.4|
  3.     var env, source;
  4.     env = EnvGen.kr(Env.perc(
  5.         releaseTime: decay, curve: curve), t_trig, doneAction: 2);
  6.     source = Mix.ar([
  7.         SinOsc.ar(tune + (env * env * 150)),
  8.         BPF.ar(LFPulse.ar(tune + (env * 100), 0, 0.2), 400, 0.6, 0);
  9.     ]) * env;
  10.     Out.ar(out, source * amp);
  11. }).add;
  12.  
  13. SynthDef(\tom, { |out = 0, freq = 80, decay = 0.125, curve = -4, punch = 1, t_trig = 1, amp = 1|
  14.     var env, source, klank, filt;
  15.     env = EnvGen.kr(Env.perc(0.01, decay, curve: curve), t_trig, timeScale: 1, doneAction: 2);
  16.     source = LFPulse.ar(freq + (env * 20));
  17.     klank = DynKlank.ar(`[
  18.         [200, 300, 400, 500],
  19.         [0.01, 0.01, 0.01, 0.01],
  20.         [0.25, 0.25, 0.25, 0.25]
  21.     ], source);
  22.     filt = HPF.ar(klank, 300) * env;
  23.     Out.ar(out, filt * amp);
  24. }).add;
  25.  
  26. SynthDef(\ch, { |out = 0, tune = 6000, decay = 0.05, curve = -2, pan = 0, t_trig = 1, amp = 0.3|
  27.     var env, noise, output;
  28.     env = EnvGen.kr(Env.perc(0.001, decay, curve: curve), t_trig, doneAction: 2);
  29.     noise = WhiteNoise.ar;
  30.     output = Mix.ar([BPF.ar(noise, tune /** env*/, 0.1) * 0.75, BPF.ar(noise, (tune * 2) /** env*/, 0.15)]) * env;
  31.     Out.ar(out, Pan2.ar(output, pan, amp));
  32. }).add;
  33.  
  34. SynthDef(\verb, { |out1 = 0, out2 = 1, in = 5|
  35.     var verb;
  36.     verb = FreeVerb.ar(In.ar(in, 1), 0.5, 0, 0.1);
  37.     Out.ar([out1, out2], verb);
  38. }).add;
  39. )
  40.  
  41. (
  42. SynthDef(\oh, {
  43.     arg t_trig = 1, amp = 0.2;
  44.     var env, noiseEnv, output, noise;
  45.     env = EnvGen.kr(Env.new([0, 1, 1, 0], [0.001, 0.25, 0.01]), t_trig, doneAction: 2);
  46.     noiseEnv = EnvGen.kr(Env.new([0, 1, 0], [0.001, /*CHANGE ME!:*/ 0.1]), t_trig);
  47.     noise = BPF.ar(WhiteNoise.ar() * noiseEnv, 2000, 1);
  48.     output = GVerb.ar(noise, 50, 10, 0, 0.2, 15, 1, 0.2, 0.6, 100);
  49.     Out.ar(0, Pan2.ar(output, 0, amp * env));
  50. }).add;
  51. )
  52.  
  53. Synth(\oh, [\trig, 1]);
  54.  
  55.  
  56. x = Synth(\kick);
  57.  
  58. s.scope;
  59.  
  60. s.scope;
  61.  
  62. (
  63. Pdef(\tom,
  64.     Pfx(
  65.         Pbind(
  66.             \instrument, \tom,
  67.             \trig, 1,
  68.             \delta, Pwrand(#[1, 0.75, 0.5, 0.25],[1,2,3,8].normalizeSum,inf),
  69.             \decay, Prand(#[0.125, 0.25, 0.5], inf),
  70.             // \freq, Prand(#[60, 80, 100], inf),
  71.             \degree, Pxrand(#[9, 11, 7, 13], inf),
  72.             \scale, Scale.minor,
  73.             \curve, -4,
  74.             \octave, 2,
  75.             \out, 5,
  76.             \amp, 0.5
  77.         ), \verb
  78.     )
  79. ).play;
  80. )
  81.  
  82. s.scope
  83.  
  84. (
  85. Pdef(\kick,
  86.     Pbind(
  87.         \instrument, \kick,
  88.         \trig, 1,
  89.         \delta, Pseq(#[1, 1, 0.75, 0.75, 0.5], inf),
  90.         \out, [0, 1],
  91.         \amp, 0.43
  92.     )
  93. ).play;
  94.  
  95. Pdef(\ch).play;
  96. )
  97.  
  98.  
  99. Pdef(\ch).stop;
  100.  
  101. MIDIClient.init;
  102. MIDIIn.connectAll;
  103. MIDIFunc.trace;
  104.  
  105. (
  106. MIDIdef.noteOn(\playkick, {
  107.     if (Pdef(\kick).isPlaying,
  108.         {Pdef(\kick).stop},
  109.         {Pdef(\kick).play}
  110. )}, 20);
  111.  
  112. MIDIdef.noteOn(\playch, {
  113.     if (Pdef(\ch).isPlaying,
  114.         {Pdef(\ch).stop},
  115.         {Pdef(\ch).play}
  116. )}, 21);
  117.  
  118. MIDIdef.noteOn(\playtom, {
  119.     if (Pdef(\tom).isPlaying,
  120.         {Pdef(\tom).stop},
  121.         {Pdef(\tom).play}
  122. )}, 22);
  123.  
  124. MIDIdef.cc(\kickamp, { |val|
  125.     Pdef(\kick).set(\amp, val.linlin(0, 127, 0.0001, 1))
  126. }, 10);
  127.  
  128. MIDIdef.cc(\champ, { |val|
  129.     Pdef(\ch).set(\amp, val.linlin(0, 127, 0.0001, 1))
  130. }, 74);
  131.  
  132. MIDIdef.cc(\tomamp, { |val|
  133.     Pdef(\tom).set(\amp, val.linlin(0, 127, 0.0001, 1))
  134. }, 71);
  135. )
  136.  
  137. (
  138. Pdef(\ch,
  139.     Pbind(
  140.         \instrument, \ch,
  141.         \trig, Pseq([1,1,1,Rest], inf),
  142.         \delta, Prand(#[0.25], inf),
  143.         \out, [0, 1],
  144.         \pan, Pfunc({0.5.rand2}),
  145.         \amp, 0.2
  146.     )
  147. ).play;
  148. )
  149.  
  150. (
  151. Pdef(\oh,
  152.     Pbind(
  153.         \instrument, \oh,
  154.         \trig, Pseq([Rest, Rest, Rest, 1], inf),
  155.         \amp, 0.2,
  156.         \delta, 0.5
  157.     )
  158. ).play;
  159. )
  160.  
  161. Synth(\temp__0).kill;
  162.  
  163. {FreeVerb.ar(In.ar(0), [1, 1], 0.05, 0.6)}.play
  164.  
  165. NdefMixer(s);
  166.  
  167. p.play; q.play; h.play;
  168.  
  169. TempoClock.default.tempo = 120/60;
Add Comment
Please, Sign In to add comment