Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (
- ////////////////////////////////////////////////////////////////////////////// KICK
- SynthDef(\randKick, {
- arg baseFreq = 75, vel = 100, envAmount = 4;
- var kik, env, penv, vol; //penv = pitch envelope, env = vca envelope
- vol = vel / 127.0;
- env = Env.linen(0.005, 0.1, 1, curve: -4);
- env = EnvGen.ar(env, doneAction: 2);
- penv = Env.perc(0, 0.15, curve: -4);
- penv = EnvGen.ar(penv) * envAmount;
- kik = HPF.ar(SinOsc.ar(baseFreq * penv, mul: env * vol), 50);
- kik = kik.dup;
- Out.ar(0, kik);
- }).add;
- ////////////////////////////////////////////////////////////////////////////// HI HAT
- SynthDef(\hiHat, {
- var hh, env, lfo1, lfo2;
- lfo1 = SinOsc.kr(0.876).range(0.005, 0.01);
- lfo2 = SinOsc.kr(0.765).range(0.01, 0.1);
- env = Env.perc(lfo1, lfo2, curve: -4);
- env = EnvGen.ar(env, doneAction: 2);
- hh = HPF.ar(PinkNoise.ar(mul: env * 0.5), 1000).dup;
- Out.ar(0, hh);
- }).add;
- ////////////////////////////////////////////////////////////////////////////// PERC
- SynthDef(\perc, {
- var percu, env;
- env = Env.perc(0.001, 0.05);
- env = EnvGen.ar(env, doneAction: 2);
- percu = HPF.ar(SinOsc.ar(300, mul: env * 0.3), 200).dup;
- Out.ar(0, percu);
- }).add;
- ////////////////////////////////////////////////////////////////////////////// SWEEP SYNTH
- SynthDef(\sweep, {
- arg freq = 200, glide = 3, spread = 100, gate = 1, cutoff = 20000;
- var sig, env, output, g1, g2, g3, g4, g5, g6, g7, g8;
- g1 = Env.new([rand2(spread) + freq, freq], [glide], 1.5);
- g1 = EnvGen.ar(g1);
- g2 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g2 = EnvGen.ar(g2);
- g3 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g3 = EnvGen.ar(g3);
- g4 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g4 = EnvGen.ar(g4);
- g5 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g5 = EnvGen.ar(g5);
- g6 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g6 = EnvGen.ar(g6);
- g7 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g7 = EnvGen.ar(g7);
- g8 = Env.new([rand2(spread) + freq, freq + rand2(2)], [glide], 1.5);
- g8 = EnvGen.ar(g8);
- env = Env.asr(0.01, glide, 2);
- env = EnvGen.ar(env, gate, doneAction: 2);
- sig = Saw.ar([g1, g2, g3, g4, g5, g6, g7, g8], mul: 0.1);
- output = LPF.ar(Splay.ar(sig), cutoff ) * env * 0.95;
- Out.ar(0, output);
- }).add;
- //////////////////////////////////////////////////////////////////////////////
- ////// SECUENCIAS //////
- ////////////////////////////////////////////////////////////////////////////
- ////////////////////////////////////////////////////////////////////////////// SECUENCIA KICK
- Routine({
- 30.do({
- k = Synth(\randKick, [\curve, rand(5)+1]);
- 0.5.wait;
- k = Synth(\randKick, [\curve, rand(5)+1]);
- 0.5.wait;
- 2.do({ // Condicionales con distintos pesos en cada beat 3 y 4 y subdivisones
- if(coin(0.95),
- {k = Synth(\randKick, [\curve, rand(5)+1]); 0.125.wait;},
- {0.125.wait;}
- );
- if(coin(0.2),
- {k = Synth(\randKick, [\vel, 20, \curve, rand(5)+1]); 0.125.wait;}, //Problemas con rand en synthdef
- {0.125.wait;}
- );
- if(coin(0.6),
- {k = Synth(\randKick, [\vel, 20, \curve, rand(5)+1]); 0.125.wait;},
- {0.125.wait;}
- );
- if(coin(0.4),
- {k = Synth(\randKick, [\vel, 20, \curve, rand(5)+1]); 0.125.wait;},
- {0.125.wait;}
- );
- });
- });
- }).play;
- ////////////////////////////////////////////////////////////////////////////// SECUENCIA HI HAT
- Routine({
- 92.do({
- 0.23.wait;
- if(coin(0.1), // Crea un flam en el hihat 10% de las veces
- {k = Synth(\hiHat); 0.02.wait;},
- {0.02.wait;}
- );
- h = Synth(\hiHat);
- 0.25.wait;
- });
- }).play;
- ////////////////////////////////////////////////////////////////////////////// SECUENCIA PERC
- Routine({
- 240.do({
- if(coin(0.9),
- {p = Synth(\perc); 0.125.wait;},
- {if(coin(0.5), // Crea un trecillo en la percusion
- {
- p = Synth(\perc);
- wait(0.125/3);
- p = Synth(\perc);
- wait(0.125/3);
- p = Synth(\perc);
- wait(0.125/3);
- },
- {0.125.wait;})}
- );
- });
- }).play;
- ////////////////////////////////////////////////////////////////////////////// SECUENCIA SWEEP SYNTH
- Routine({
- ~swoop = 100;
- 13.do({
- ~swoop = ~swoop * 1.5; // Frecuencia cutoff del filtro (LPF) se multiplica pos 1.5 cada repeticion
- postln(~swoop);
- a = Synth(\sweep, [\freq, 200, \cutoff, ~swoop]);
- 3.5.wait;
- a.set(\gate, 0);
- 0.5.wait;
- });
- }).play;
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement