1
0
Fork 0

added bunch of comments to 2021-01-24-acid-funk

main
Luka Prinčič 2021-01-26 10:36:09 +01:00
parent 17c8cb7615
commit 7a5c03fe2d
1 changed files with 74 additions and 18 deletions

View File

@ -1,85 +1,141 @@
( fork {
// acid bass synthdef
SynthDef(\bz, {
arg gate=1, freq=440, amp=0.1, cutoff=1000, rq=0.1;
var snd, env, cutoffenv;
// slight detuning into stereo. will cause channel expansion later.
freq = [freq, freq * 1.02];
// enveloping cutoff frequency of the LP filter!!!!
// amplitude envelope. doneAction:2 frees the synth at the end of env.
env = EnvGen.ar(
envelope: Env.adsr(0.01, 0.1, 0.5, 0.5),
gate: gate,
doneAction:2 );
// main oscilation - sawtooth wave and squarewave
snd = Pulse.ar(freq);
snd = Saw.ar(freq * 0.98) + (snd * 0.5);
// add some saturation/distortion
snd = snd * 5;
snd = snd.softclip;
// cutoff frequency envelope for low-pass
cutoffenv = EnvGen.ar( Env.adsr(decayTime: 0.1,
sustainLevel: 0.5, releaseTime:0.5),
gate: gate );
cutoff = cutoff * cutoffenv;
cutoff = cutoff.max(50);
// enveloping the amplitude and freeing the synth at end!
env = EnvGen.ar(
envelope: Env.adsr(0.01, 0.1, 0.5, 0.5),
gate: gate,
doneAction:2 );
snd = Pulse.ar(freq);
snd = Saw.ar(freq * 0.98) + (snd * 0.5);
snd = snd * 5;
snd = snd.softclip;
// resonating low-pass filter
snd = RLPF.ar(snd, cutoff, rq);
// finalize (low (0.1) rq (high resonance) can cause loud spikes)
snd = Limiter.ar(snd);
snd = snd * env * amp;
// output
Out.ar(0, snd);
}).add;
SynthDef(\hh, {
arg amp=0.1, outBus=0, gate=1, sustain;
var snd, env;
// simple noise
snd = WhiteNoise.ar;
// high-pass filter
snd = HPF.ar(snd, 2000);
// amplitude envelope
env = EnvGen.ar(Env.perc(0, sustain), doneAction:2);
// put it together
snd = snd * env * amp;
// output
Out.ar(outBus, snd!2);
}).add;
SynthDef(\snare, {
arg amp = 0.2;
var snd, env;
env = EnvGen.ar(Env([0,1,0], [0.001, 0.2], curve: -4), doneAction:2);
// Generates noise which results from flipping random bits in a word.
// This type of noise has a high RMS level relative to its peak to
// peak level. The spectrum is emphasized towards lower frequencies.
snd = GrayNoise.ar.dup;
// amplitude envelope
env = EnvGen.ar(Env([0,1,0], [0.001, 0.2], curve: -4), doneAction:2);
// put it together and output
snd = snd * env * amp;
Out.ar(0, snd);
}).add;
s.sync;
// patterns
// bassline pattern // --
Pbindef(\bzPat,
\instrument, \bz,
\amp, 0.6,
// the main rhythmic sequence
\dur, Pseq([1/2, 1/4, 1/4] , inf)
* Pseq([Pseq([1, 1/2],20),1/2,1,1/2,1/2], inf),
// playing first three notes in a scale
\degree, Pseq([0, 1, 2], inf),
// of minor
\scale, Scale.minor,
// stay in 3rd octave, only occasionaly veer to 2 or 4
\octave, Pwrand([2, 3, 4], [0.1, 0.8, 0.1], inf),
// randomly change length of notes
\legato, Pxrand( (1..9) / 10, inf),
\cutoff, Prand((1..10) * 190 + 150, inf),
// Pseg creates segments in time. this is main 2min "composition"
\cutoff, Pseq([
Pseg([100,8000,500],[20,10], \exp, 1),
Pseg([500, 4000, 1000, 8000, 800, 2000, 500], 5, \exp, 1),
Pseg([500,8000,100], [10,20], \exp, 1)
]),
// randomly change resonance
\rq, Prand((1..9) * 0.1, inf),
).play;
// high hat pattern // --
Pbindef(\hhPat,
\instrument, \hh,
// make it ... er.. "human", by variation in amplitude
\amp, Prand((2..4) * 0.05, inf),
// specific number of 8th notes - 1.5 minute
\dur, Pseq([1/8], 8 * 60 * 1.5),
// by making third note longer, sounds like closed and open hats
\legato, Pseq([0.5, 0.5, 1, 0.5],inf),
).play;
// snare pattern // --
Pbindef(\snPat,
\instrument, \snare,
// main rhythm. it's 2 and a quarter note long loopo
\dur, Pseq([Rest(1/2), 1/2, Rest(7/8), 3/8 ], inf),
// fade in and fade out using Pseg(ment)
\amp, Pseg([0,0.4,0.4,0] + 0.0001, [15, 60, 15], \exp),
).play;