(
//Global Variables
~thisPath = (PathName.new(Document.current.path)).pathOnly;// ~ tilda means global variable
//Buffer sounds
b = Buffer.read(s,~thisPath++"glass_cymbal.wav");
)
( //Mod Synth
SynthDef (
\ModSynth,
{
//Arguments
arg freq = 1000, //argument that can be sequenced
modBus = 30;
//Variables
var mod;
//Modulator
mod = SinOsc.kr(
freq: freq,
phase: 1,
mul: 0.5
);
//Output
Out.kr(modBus, mod);
}
).store;
//Mod Synth2
SynthDef (
\ModSynth2,
{
//Arguments
arg modBus = 31;
//Variables
var mod;
//Modulator
mod = LFSaw.ar(
freq: LFSaw.kr(4, 0, 200, 400),
iphase: 0,
mul: 0.5
);
//Output
Out.kr(modBus, mod);
}
).store;
//Carrier Synth
SynthDef (
\carrier,
{
//Arguments
arg carrierFreq = 880, //argument that can be sequenced
iPhase = 0,
dur = 3, //argument that can be sequenced
legato = 2, //argument that can be sequenced
modBusIn = 30,
modBusIn2 = 31,
bus = 21;
//Variables
var carrier,
env,
mod,
mod2;
//Input Busses
mod = In.kr(modBusIn, 1);
mod2 = In.kr(modBusIn2, 1);
//Carrier
carrier = LFTri.ar(
freq: carrierFreq,
iphase: iPhase,
mul: 1,
add: mod * mod2
);
//Envelope
env = carrier * EnvGen.kr(Env.perc(
0,
dur*legato),
doneAction:2
);
//Output
Out.ar(bus, env);
}
).store;
//1st Effect
SynthDef (
\FX1,
{
//Arguments
arg out = 0,
in = 21,
delayTime = 3.5, //argument that can be sequenced
bus = 21;
//Variables
var audio,
fx1;
//Input Bus
audio = In.ar([in, in], 1);
//Effect
fx1 = CombN.ar(audio,
maxdelaytime: 5.0,
delaytime: delayTime,
decaytime: 5,
mul: 1,
add: audio
);
//Output
Out.ar(bus, fx1);
}
).store;
//2nd Effect
SynthDef (
\FX2,
{
//Arguments
arg out = 0,
in = 21,
filterRq = 0.8; //argument that can be sequenced
//Variables
var audio,
fx2;
//Input Bus
audio = In.ar([in, in], 1);
//Effect
fx2 = RLPF.ar(
in: audio,
freq: 220,
rq: filterRq
);
//Output
Out.ar(0, fx2);
}
).store;
)
(
d = Synth.after(1,"ModSynth");
g = Synth.after(1, "ModSynth2");
e = Synth.after(1, "FX2");
f = Synth.after(1, "FX1");
)
( Pbind(
\instrument, "carrier",
\freq, Pfunc({rrand(800, 1000)}),
\dur, Pfunc({rrand(0.5, 7)}),
\legato, Prand(#[0.1, 0.5, 1, 1.5], 8),
\delayTime, Prand(#[3.5, 0.2, 2.5, 5], 16),
\filterRq, Pseq(#[0.4, 0.1, 0.9, 0.6], 4)
).play;
)