MM – Minimal “Farben” style playable project

This is another example of live coding.

A more coherent complete song.

Get the IR here.

https://drive.google.com/open?id=1DjcM3x6YZhncOdi2tOkwoTuhyic5OYUe

//Minimal "Farben" style playable project. 2020 Matias Monteagudo.

//Here you can set your interface options. Change at will.

(
Server.local.options.device = "ASIO : ASIO PreSonus FireStudio";
Server.local.options.sampleRate=48000;
Server.local.options.hardwareBufferSize=128;
)

s.boot;

//First let's add some mild distortion and reverb.

//Load your IR.
(
~path="G:/IRs/Echochamber favs/springreverbs/Great SpringrevStereo.wav";
~ezConv=EZConv(~path);
)

~ezConv.numChannels;//Test how many channels your IR has.
~ezConv.free; //Unload the IR. You might want to do this before loading a new one.

//Evaluate the Distortion/Reverb engine.

(
SynthDef(\Fx, { |out, wet=0.1, dry=1,distamt=1|
	var signal, dist, rev;
	signal = In.ar(out, 2);
	dist=In.ar(out, 2).pow(distamt);
	rev=~ezConv.ar([signal[0],signal[1]],0.1,1);
	ReplaceOut.ar(0, (rev*wet)+(dist*dry));
}).add;
);

//Start the FX engine here.
z = Synth(\Fx, [\outbus, 0, \distamt,0.9,\wet, 0.01, \dry, 1.6], addAction:\addToTail); //You can restart the Fx here.
z.free;//Stop it here if you wanna change the parameters. (not that you'll want anyway, it's fine tuned)

//Synths. Evaluate them before starting.

//Noise Synth.
(
SynthDef(\noise, {
	|gate=1,amp=1, pan=0,cutoff=3000,res=1,attk=0.01,dec=5,curv= -100|
	var sig, filt, panpos;
	sig=WhiteNoise.ar(EnvGen.ar(Env([0,amp,0],[attk,dec],curv),gate,doneAction:2));
	filt=BPF.ar(sig,cutoff,res,1);
	panpos=Pan2.ar(filt,pan);
	Out.ar(0,panpos)
}).add
)

Synth(\noise, [\pan,0])

//Kick Synth.
(
SynthDef(\kick, {
	|gate=1,freq=12,amp=1, pan=0,cutoff=100,res=4,atk=0.01,dec=0.2,curv= -4,dist=0|
	var sig, filt, panpos;
	sig=LFTri.ar(freq*EnvGen.ar(Env([0,5,0],[0.01,dec]),1,doneAction:2),0,EnvGen.ar(Env([0,amp,0],[atk,dec],curv),gate,doneAction:2));
	filt=BPF.ar(sig,cutoff,res);
	panpos=Pan2.ar(filt,pan);
	Out.ar(0,panpos)
}).add
)

Synth(\kick)

//Clicks.
(
SynthDef(\click, {
	|gate=1,freq=0.001,amp=0.03, pan=0,cutoff=1500,res=2,atk=0.001,dec=0.001,curv= -4,dist=0|
	var sig, filt, panpos;
	sig=Pulse.ar(freq,0.5,EnvGen.ar(Env([0,amp,0],[atk,dec],curv),gate,doneAction:2));
	filt=BPF.ar(sig,cutoff,res);
	panpos=Pan2.ar(filt,pan);
	Out.ar(0,panpos)
}).add
)

Synth(\click, [\cutoff,1000]);

//Pad 1.
(
SynthDef(\pad, {
	|gate=1, amp=0.1, freq=200, panpos=0, attk=1, dec=4, cur=0|
	var sig1,sig2,sig1f,sig2f,pan;
	sig1=Pulse.ar(freq-0.7,0.95,EnvGen.ar(Env.perc(attk,dec,amp,cur),gate,doneAction:2));
	sig2=Pulse.ar(freq+0.7,0.95,EnvGen.ar(Env.perc(attk,dec,amp,cur),gate,doneAction:2));
	sig1f=LPF.ar(sig1, LFSaw.ar(7,0,800,800),1);
	sig2f=LPF.ar(sig2, LFSaw.ar(7,0,800,800),1);
	pan=Balance2.ar(sig1f,sig2f,panpos,1);
	Out.ar(0,pan)
}).add
)

Synth(\pad, [\pan, 0, \attk,0.5, \dec,2,\cur,0])

//Pad 2.
(
SynthDef(\pad2, {
	|gate=1, amp=0.05, freq=200, panpos=0, attk=1, dec=4, cur=0|
	var sig1,sig2,sig1f,sig2f,pan;
	sig1=LFTri.ar(freq-0.7,0,EnvGen.ar(Env.perc(attk,dec,amp,cur),gate,doneAction:2));
	sig2=LFTri.ar(freq+0.7,0,EnvGen.ar(Env.perc(attk,dec,amp,cur),gate,doneAction:2));
	sig1f=LPF.ar(sig1, LFSaw.ar(3.5,0,800,800),1);
	sig2f=LPF.ar(sig2, LFSaw.ar(3.5,0,800,800),1);
	pan=Balance2.ar(sig1f,sig2f,panpos,1);
	Out.ar(0,pan)
}).add
)

Synth(\pad2, [\pan, 0, \attk,0.5, \dec,2,\cur,0])

//Bass.
(
SynthDef(\bass, {
	|gate=1, amp=1, freq=200, pan=0, attk=1, dec=4, cur=0|
	var sig1,sig2,panpos;
	sig1=LFTri.ar(freq-0.5,0,EnvGen.ar(Env.perc(attk,dec,amp,cur),gate,doneAction:2));
	sig2=LFTri.ar(freq+0.5,0,EnvGen.ar(Env.perc(attk,dec,amp,cur),gate,doneAction:2));
	panpos=Balance2.ar(sig1,sig2,pan,1);
	Out.ar(0,panpos)
}).add
)

Synth(\tri, [\panpos, 0, \attk,0.001, \dec,0.4,\cur,-10])

//Waves.
(
SynthDef(\waves, {
	|amp=4, fq=1200, edur=2, gate=1, bal= 0|
	var sig1,sig2,filt1,filt2,balpos,mix;
	sig1=PinkNoise.ar(EnvGen.ar(Env([0,amp,0],[edur,edur],0,0),gate,doneAction:2));
	sig2=PinkNoise.ar(EnvGen.ar(Env([0,amp,0],[edur,edur],0,0),gate,doneAction:2));
	filt1=HPF.ar(sig1, fq);
	filt2=LPF.ar(sig1, fq);
	balpos=Balance2.ar(filt1,filt2,bal,1);
	Out.ar(0, balpos)
}).add;
);

Synth(\waves, [\panpos, 0]);

//Sequences. Evaluate each sequence definition. Then use the "start / stop" lines below each. You can use variations and recipes.
//The game here is how to start, variate and end so the song is somewhat coherent.

//First set your tempo. Needs to be 110 for maximum enjoyment. :)
TempoClock.tempo=110/60;

//Waves (just to have a nice bed to lay down the rest. Starting with this is recommended. (then the pads below probably)

(
~waves=Pbind(\instrument, \waves, \gate,1,
	\amp, Pwhite(0.02, 0.13),
	\fq, Pwhite(1000,3500),
	\bal, Pwhite(-0.8,0.8),
	\edur, Pwhite(1,4),
	\dur, Pwhite(1,6)
))

~waves.play
~waves.stop

//Noise sequences.
(
Pdefn(\ngate, Prand(#[1,rest,1,rest,1,1,rest,1],inf));
Pdefn(\ndur, 0.25);
Pdefn(\namp, Pseq([0.2,0.2,0.05,0.05],inf));
Pdefn(\ncutoff,3000);
Pdefn(\ndec, Pwhite(0.2,2));
Pdefn(\npan, Pwhite(-0.3,0.3));
(
~noise=Pbindef(\a, \instrument, \noise, \attk,0.001,
	\gate, Pdefn(\ngate),
	\cutoff, Pdefn(\ncutoff),
	\amp, Pdefn(\namp),
	\dec, Pdefn(\ndec),
	\pan, Pdefn(\npan),
	\dur, Pdefn(\ndur)
));
)
//Noise variations.
Pdefn(\ngate, 1);
Pdefn(\ngate, Pseq(#[1,rest,1,rest,1,1,rest,1],inf));//Steady
Pdefn(\ngate, Prand(#[1,rest,1,rest,1,1,rest,1],inf));//Random
Pdefn(\namp,0.2);
Pdefn(\namp, Pseq([0.2,0.2,0.05,0.05],inf));
Pdefn(\ncutoff,3000);
Pdefn(\ncutoff, Prand([2000,3000,5000,6000],inf));//Random cutoff. Default.
Pdefn(\ncutoff, Plprand(300,6000,inf));//Prefers low levels.
Pdefn(\ndur, 0.25);
Pdefn(\ndur, 0.125);
Pdefn(\ndec, Pwhite(0.2,2));//Tight hats.
Pdefn(\ndec, Pwhite(0.2,8));
Pdefn(\ndec, Pwhite(0.2,20));
Pdefn(\ndec, Pseries(0.002,0.1,inf));//Progressive increase in decay. You can use for buildup.
Pdefn(\ndec, Pwhite(10,20));//Max decay, Max buildup.

//Random nice recipe
(
Pdefn(\ndur, 0.25);
Pdefn(\namp, Pseq([0.2,0.2,0.05,0.05],inf));
Pdefn(\ngate, Prand(#[1,rest,1,rest,1,1,rest,1],inf));
Pdefn(\ndec, Pwhite(0.2,2));
Pdefn(\npan, Pwhite(-0.3,0.3));
)

//Triad recipe.
(
Pdefn(\namp, 0.1);
Pdefn(\ndur, 0.75);
Pdefn(\ndec, Pwhite(10,20));
)

~noise.play
~noise.stop

//Kick sequences.
(
Pdefn(\kgate, 1);
Pdefn(\kdur, 1);
Pdefn(\kamp,0.2);
Pdefn(\kdec, 0.2);
Pdefn(\kfreq, 15);
(
~kick=Pbindef(\b, \instrument, \kick, \attk,0.001, \pan, 0,
	\gate, Pdefn(\kgate),
	\amp, Pdefn(\kamp),
	\freq, Pdefn(\kfreq),
	\dec, Pdefn(\kdec),
	\dur, Pdefn(\kdur)
));
)

//Kick variations.
Pdefn(\kdec, 2);
Pdefn(\kdec, 0.1);
Pdefn(\kdur, 0.25);
Pdefn(\kgate, Pseq(#[1,rest,1,1,rest,1],inf));

Pdefn(\kamp,0.3);
Pdefn(\kfreq, 10);

//Randomized recipe. Good for spicing up rhythm.
(
Pdefn(\kdur, 0.25);
Pdefn(\kgate, Pseq(#[1,rest,1,1,rest,rest,1],inf));
Pdefn(\kamp, Pseq([0.1,0.05,0.05,0.2,0.1]*2.5,inf));
)

//Four on the floor recipe.
(
Pdefn(\kdur, 1);
Pdefn(\kgate, 1);
Pdefn(\kamp,0.55);
Pdefn(\kfreq, Pwhite(10,15));
)

~kick.play;
~kick.stop;

//Click sequences.

(
Pdefn(\cgate, Prand(#[1,rest,rest,rest,1,rest,rest,rest,rest,rest,rest,rest,rest,rest,1,rest,1,rest,rest,rest,rest,1],inf));
Pdefn(\cdur, 0.25);
Pdefn(\ccutoff,3000);
Pdefn(\cfreq, Plprand(100, 2000,inf));
Pdefn(\camp, Pseq([0.05,0.05,0.05,0.05]*10,inf));
Pdefn(\cdec, 0.001);
Pdefn(\cpan, Pwhite(-1,1));
(
~click=Pbindef(\c, \instrument, \click, \attk,0.001,
	\dec, Pdefn(\cdec),
	\pan, Pdefn(\cpan),
	\gate, Pdefn(\cgate),
	\cutoff, Pdefn(\ccutoff),
	\freq, Pdefn(\cfreq),
	\amp, Pdefn(\camp),
	\dur, Pdefn(\cdur)
));
)

//Click variations.
Pdefn(\cfreq, 3000);
Pdefn(\cfreq, Pwhite(100, 4000,inf));//Random
Pdefn(\cfreq, Pexprand(100, 4000,inf));//Prefer high values
Pdefn(\cfreq, Plprand(100, 2000,inf));//Prefer low values.
Pdefn(\cgate, 1);
Pdefn(\cdur, 0.25);
Pdefn(\cdur, 0.125);
Pdefn(\cgate, Pseq(#[1,rest,rest,rest,rest,rest,rest,1,rest,rest,1,rest,rest,],inf));
Pdefn(\cgate, Pseq(#[1,rest,rest,rest,1,rest,rest,1,1,1,rest,rest,rest,rest,1],inf));
Pdefn(\cgate, Prand(#[1,rest,rest,rest,1,rest,rest,rest,rest,rest,rest,rest,rest,rest,1,rest,1,rest,rest,rest,rest,1],inf));//Default
Pdefn(\camp,0.9);
Pdefn(\camp, Pseq([0.05,0.05,0.05,0.05]*10,inf));//Default amp seq.
Pdefn(\ccutoff,1000);
Pdefn(\ccutoff, Prand([500,4000,5000,6000,9000],inf));
Pdefn(\cdec, 0.00015);
Pdefn(\cdec, 0.001);
Pdefn(\cdec, 0.01);//Slightly higher dec.
Pdefn(\cpan, Pwhite(-1,1));

~click.play
~click.stop

//Pads sequences.

(
Pdefn(\pdur, 8);
Pdefn(\pamp,0.027);
Pdefn(\pdegree, Prand(#[\Am7_Gs,rest,\Dm7_Cs,rest, \Fmajor7_E].chordProg,inf));
(
~pads1=Pbindef(\d, \instrument, \pad, \attk,3, \dec, 3, \pan, 0, \scale, Scale.chromatic, \octave,4,
	\gate, Pdefn(\pgate),
	\cutoff, Pdefn(\pcutoff),
	\degree, Pdefn(\pdegree),
	\amp, Pdefn(\pamp),
	\dur, Pdefn(\pdur)
));
)

~pads1.play
~pads1.stop

//Pads2 sequences.

(
Pdefn(\pdur, 10);
Pdefn(\pamp,0.025);
Pdefn(\pdegree, Prand(#[\Am7_Gs,rest,\Dm7_Cs,rest, \Fmajor7_E].chordProg,inf));
(
~pads2=Pbindef(\g, \instrument, \pad2, \attk,3, \dec, 3, \pan, 0, \scale, Scale.chromatic, \octave,4,
	\gate, Pdefn(\pgate),
	\cutoff, Pdefn(\pcutoff),
	\degree, Pdefn(\pdegree),
	\amp, Pdefn(\pamp),
	\dur, Pdefn(\pdur)
));
)

~pads2.play
~pads2.stop

//Bass sequences.
(
Pdefn(\bdur, 0.25);
Pdefn(\bamp,0.3);
Pdefn(\bdegree, Prand(#[2,9,14,rest,rest,rest,rest,rest,rest,rest],inf));
Pdefn(\bdec, 0.2);
(
~bass=Pbindef(\e, \instrument, \bass, \attk,0.001, \scale, Scale.chromatic, \octave,2,
	\dec, Pdefn(\bdec),
	\degree, Pdefn(\bdegree),
	\amp, Pdefn(\bamp),
	\dur, Pdefn(\bdur)
));
)
//Standard Bass recipe
(
Pdefn(\bdur, 0.25);
Pdefn(\bdec, 0.15);
Pdefn(\bamp, 0.2);
)
//Long notes recipe.
(
Pdefn(\bdur, 1);
Pdefn(\bdec, 1);
Pdefn(\bamp, 0.15);
)

~bass.play
~bass.stop

//Drops sequence.

(
Pdefn(\b2dur, 0.25);
Pdefn(\b2amp,0.13);
Pdefn(\b2degree, Prand(#[0,9,14,rest,rest,rest,rest,rest,rest,rest],inf));
Pdefn(\b2dec, 0.5);
Pdefn(\p2pan, Pwhite(-0.6,0.6));
(
~drops=Pbindef(\f, \instrument, \bass, \attk,0.001, \cur, -40, \scale, Scale.chromatic,
	\octave, Prand([4,5,6],inf),
	\dec, Pdefn(\b2dec),
	\degree, Pdefn(\b2degree),
	\amp, Pdefn(\b2amp),
	\pan, Pdefn (\p2pan),
	\dur, Pdefn(\b2dur)
));
)

~drops.play
~drops.stop
Author
418 PM
  • Platform:
  • Category: Composition
  • Revision: 1.0
  • License: GNU General Public License family
  • Views: 178
  • Modified: 5 months ago
Chat about this patch on Discord!
Appreciate

Leave a Reply