Skip to content

Instantly share code, notes, and snippets.

@ALOUT
Created June 5, 2014 11:46
Show Gist options
  • Save ALOUT/6c7fa23df8e9e37319f3 to your computer and use it in GitHub Desktop.
Save ALOUT/6c7fa23df8e9e37319f3 to your computer and use it in GitHub Desktop.
Glanular+Bass+Drum+MasterEffects SynthDef
(
SynthDef("testSynth", {|amp=1.0, freq=440, decay=0.2|
var out;
out = SinOsc.ar(freq);
out = out * Line.kr(amp, 0, decay, doneAction:2);
out = Pan2.ar(out);
Out.ar(0, out);
}).send(s);
SynthDef("hat", {
arg outBus=0, amp=0.3;
var env1, env2, out, oscs1, noise, n, n2;
n = 5;
thisThread.randSeed = 4;
env1 = EnvGen.ar(Env.new([0, 1.0, 0], [0.001, 0.2], [0, -12]));
env2 = EnvGen.ar(Env.new([0, 1.0, 0.05, 0], [0.002, 0.05, 0.03], [0, -4, -4]), doneAction:2);
oscs1 = Mix.fill(n, {|i|
SinOsc.ar(
( i.linlin(0, n-1, 42, 74) + rand2(4.0) ).midicps,
SinOsc.ar( (i.linlin(0, n-1, 78, 80) + rand2(4.0) ).midicps, 0.0, 12),
1/n
)
});
oscs1 = BHiPass.ar(oscs1, 1000, 2, env1);
n2 = 8;
noise = WhiteNoise.ar;
noise = Mix.fill(n2, {|i|
var freq;
freq = (i.linlin(0, n-1, 40, 50) + rand2(4.0) ).midicps.reciprocal;
CombN.ar(noise, 0.04, freq, 0.1)
}) * (1/n) + noise;
noise = BPF.ar(noise, 6000, 0.9, 0.5, noise);
noise = BLowShelf.ar(noise, 3000, 0.5, -6);
noise = BHiPass.ar(noise, 1000, 1.5, env2);
out = noise + oscs1;
out = out.softclip;
out = out * amp;
Out.ar(outBus, out.dup);
}
).send(s);
SynthDef("kick", {
arg outBus=0,amp=0.3;
var env0, env1, env1m, out;
env0 = EnvGen.ar(Env.new([0.5, 1, 0.5, 0], [0.005, 0.06, 0.26], [-4, -2, -4]), doneAction:2);
env1 = EnvGen.ar(Env.new([110, 59, 29], [0.005, 0.29], [-4, -5]));
env1m = env1.midicps;
out = LFPulse.ar(env1m, 0, 0.5, 1, -0.5);
out = out + WhiteNoise.ar(1);
out = LPF.ar(out, env1m*1.5, env0);
out = out + SinOsc.ar(env1m, 0.5, env0);
out = out * 1.2;
out = out.clip2(1);
out = Limiter.ar(MidEQ.ar(out, 200, 1.0, 8));
out = out * amp;
Out.ar(outBus, out.dup);
}).send(s);
SynthDef("clap", {
arg outBus=0, amp = 0.5;
var env1, env2, out, noise1, noise2;
env1 = EnvGen.ar(Env.new(
[0, 1, 0, 1, 0, 1, 0, 1, 0],
[0.001, 0.013, 0, 0.01, 0, 0.01, 0, 0.03],
[0, -3, 0, -3, 0, -3, 0, -4]));
env2 = EnvGen.ar(Env.new(
[0, 1, 0],
[0.02, 0.3],
[0, -4]),
doneAction:2);
noise1 = WhiteNoise.ar(env1);
noise1 = HPF.ar(noise1, 600);
noise1 = BPF.ar(noise1, 2000, 3);
noise2 = WhiteNoise.ar(env2);
noise2 = HPF.ar(noise2, 1000);
noise2 = BPF.ar(noise2, 1200, 0.7, 0.7);
out = noise1 + noise2;
out = out * 2;
out = out.softclip * amp;
Out.ar(outBus, out.dup);
}
).send(s);
SynthDef("grain1", {
arg outBus= 0, gate = 1, amp = 0.05, pan = 0, sndbuf, envbuf = -1;
var env, freqdev, grain, out;
env = EnvGen.kr(
Env.linen(0, 0.1, 10, 0.01, \sine),
gate,
doneAction:2);
envbuf = EnvGen.kr(
Env.linen(0, 0.1, 1/2, 0.6, \sine),
doneAction:2);
pan = LFNoise1.kr.range(-0.5, 0.5);
grain = GrainBuf.ar(2,
Impulse.kr(10),
1,
sndbuf,
//LFNoise1.kr.range(0, 10.5),
LFNoise1.kr(envbuf),
LFNoise2.kr(0.5).range(0, 10000),
4,
pan,
-1);
out = grain;
out = BPF.ar(out, 1200, 0.7, 0.7);
out = out * 10;
out = out.softclip * amp;
out = Limiter.ar(MidEQ.ar(out, 14000, 0.9, 30));
Out.ar(outBus , out * env)
}
).send(s);
SynthDef("Bass", {
arg amp=0.7, freq=0, gate=1;
var out,env,sweep;
sweep = Impulse.kr(4).round;
out = SinOsc.ar(freq,(Sweep.ar(sweep, 2pi * [52.8, 200]) + (pi/6)).wrap(-pi, pi), [1, 0.1]).mean.tanh;
env = EnvGen.kr(
Env([0.1, 0.5, 0.4, 0], [0, 0.2, 0.1], -5),
gate,
doneAction:2);
out = out * env;
out = out.softclip * amp;
out = Pan2.ar(out);
Out.ar(0, out);
}).send(s);
SynthDef(\FreeVerb2x2, {|outbus, mix = 0.25, room = 0.15, damp = 0.5, amp = 1.0|
var signal;
signal = In.ar(outbus, 2);
ReplaceOut.ar(outbus,FreeVerb2.ar(signal[0],signal[1],mix, room, damp, amp));
}
).send(s);
SynthDef(\compressor, {
var in,compressed;
in = In.ar(0,2);
compressed = Compander.ar(in, in, 0.3, 1, 1/8, 0.002, 0.01);
ReplaceOut.ar(0, compressed * 8);
}).send(s);
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment