diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d899f65 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.wav filter=lfs diff=lfs merge=lfs -text diff --git a/00_init.scd b/00_init.scd new file mode 100644 index 0000000..ba443cc --- /dev/null +++ b/00_init.scd @@ -0,0 +1,95 @@ +fork { + + + var libPath, smpPath; + + // be nice, say hi. + post("\n\n\n\n\n"); + 30.do({post("- ")}); + postln ("\nhello. this is algoforte 03 project."); + 30.do({post("- ");0.05.wait;}); + post("\n"); + + smpPath = PathName.new( + PathName.new(thisProcess.nowExecutingPath).pathOnly +/+ "smp/"); + + ~granSmp = smpPath.files; + ~granBfrList = List(); + ~granBfr = List(); + Buffer.freeAll(s); + + postln("\n--- recording buffers init ..."); + // buffer for recording + ~pBuf1 = Buffer.alloc(s, s.sampleRate * 4, 2); + ~pBufMono1 = Buffer.alloc(s, s.sampleRate * 4); + + 0.2.wait; + + postln(" \n~~~ loading soundfiles ..." ); + ~granSmp.do({ |item, i| + postln(" " + i + "" + item.folderName +/+ item.fileName); + ~granBfrList.add(item.fileName); + ~granBfr.add(Buffer.readChannel(s, item.fullPath, channels:[0])); + // [0] forces mono! + }); + + 0.2.wait; + + postln("\n--- loading libs ..."); + libPath = PathName.new( + PathName.new(thisProcess.nowExecutingPath).pathOnly +/+ "lib/"); + libPath.filesDo({|afile| + // for each file in list, load/execute it + postln(">>> loading file: " + afile.folderName +/+ afile.fileName); + this.executeFile(afile.fullPath); + }); + + 0.2.wait; + + postln("\n--- creating busses ..."); + ~fxJPverbBus1.free; ~fxJPverbBus1 = Bus.audio(s, 2); + ~fxGverbBus1.free; ~fxGverbBus1 = Bus.audio(s, 2); + ~fxFeedDelayBus1.free; ~fxFeedDelayBus1 = Bus.audio(s, 2); + ~fxDelayWarpBus1.free; ~fxDelayWarpBus1 = Bus.audio(s, 2); + + 0.2.wait; + + postln("\n--- loading effects ..."); + + postln("\n--- please wait (FAILURE IN SERVER errors are ok here) ..."); + + + 0.5.wait; + ~fxJPverb1.free; + ~fxJPverb1 = Synth( \fxJPverb, + [\in, ~fxJPverbBus1, \wet, 3, \decay, 5], + addAction:\addToTail); + 0.2.wait; + + ~fxGverb1.free; + ~fxGverb1 = Synth( \fxGverb, + [\in, ~fxGverbBus1, \early, 0.1, \tail, 0.7, \decay, 10], + addAction:\addToTail); + 0.2.wait; + + ~fxFeedDelay1.free; + ~fxFeedDelay1 = Synth( \fxFeedDelay, + [\in, ~fxFeedDelayBus1, \feedback, 0.99, \time, 2], + addAction:\addToTail); + + 0.2.wait; + + ~fxDelayWarp1.free; + ~fxDelayWarp1 = Synth( \fxDelayWarp, + [\in, ~fxDelayWarpBus1, \wet, 0.5], + addAction:\addToTail); + + 0.5.wait; + + postln("\n--- done loading effects."); + + 30.do({post("- ");0.05.wait;}); + + postln("\n~~~ readyForPlay.\n\n\n"); + +}; diff --git a/BLACK_HOLE_BLACK_STAR.scd b/BLACK_HOLE_BLACK_STAR.scd new file mode 100644 index 0000000..c58f8e0 --- /dev/null +++ b/BLACK_HOLE_BLACK_STAR.scd @@ -0,0 +1,90 @@ +// ---------------------------------------------------------------------------- +// BLACK HOLE BLACK STAR +( +~tf.stop; ~tf = fork{ loop{ TempoClock.default.tempo = 0.1.rand + 1 * 0.95; 1.wait;}}; + +fork { + + ~fxDelayWarp1.set(\wet, 0.2); + ~fxJPverb1.set(\wet, 0.9); + + Pbindef(\dustyLadder, *[ + instrument: \dustyPinkClip, + legato:1, + dur:4, + amp: Pseg([0.01, 0.05, 0.01],[30],\lin, inf), + density:50, + out: Pseq([~fxDelayWarpBus1, ~fxJPverbBus1],inf) + ]).play(quant:2); + + 30.wait; + + // piano + Pbindef(\blackHole, *[ type: \midi, midicmd: \noteOn, midiout: m, chan: 1, + amp: Ptuple([ Pwhite(0.6,0.9), Pwhite(0.6,0.9) ], inf) + * Pseg([0.9, 0.6, 0.9], [0.1,59.9], \lin, inf), + legato: Pwhite(0.8, 1) * Pseg([0.8, 1, 0.8], 30, \lin, inf), + dur: Prand([1.5, 1, 0.5, 2, Pn(1/4,1), Pn(1/8,2)],inf) * 4, + scale: Scale.minor, + degree: Prand([[0,8],[0,9], 4, [6,3], [0,4,6]], inf), + octave: Prand([4,5,[5,4]],inf) + Pdup(20, Pseq([0,1],inf)) - 1, + mtranspose: Pdup(40, Pseq([0,5],inf)) + ]).play(quant:1); + + // recorder + Pbindef(\justRecPbind, *[ amp:0, dur: 4, + rec: Pfunc({ arg ev; + s.bind { SynthDef(\recBuf, { |bufnum = 0| + RecordBuf.ar( SoundIn.ar([0,1]), bufnum, + preLevel: 0, + doneAction: Done.freeSelf, loop:0 ) + }).play(s, [\bufnum, ~pBuf1], addAction: \addToTail); } }) + ]).play(quant:1); + + 30.wait; + + // Pbindef(\dustyLadder).stop + + // buffer player/oscilator - play + Ndef(\bufosc, { + var snd, pos; + pos = LFNoise1.kr(1/2!2).range(0, 4*48000); + snd = BufRd.ar(2, ~pBuf1, + Phasor.ar(0, -1 * BufRateScale.kr(~pBuf1) * LFNoise1.kr(1/10!2).range(0.99,1.01), + 0+pos, 48000/8+pos), + 1, 4 ); + snd = LPF.ar(snd, LFNoise1.kr(1/10!2).exprange(500,10000)); + snd = HPF.ar(snd, 100); + snd = Greyhole.ar(snd, feedback: LFNoise1.kr(1/10).range(0.4,0.9)) * 2 + snd * 0.3; + snd = Limiter.ar(snd, 0.9); + snd * LFNoise1.kr(1/10).range(0.5,0.95); + }); + + 1.wait; + + Ndef(\bufosc).fadeTime = 10; + + 1.wait; + + Ndef(\bufosc).play; + + 240.wait; + + // stop recording into a buffer + Pbindef(\justRecPbind).stop; + + // stop the piano pattern + Pbindef(\blackHole).stop; + + 60.wait; + + // fade out the buffer player + Ndef(\bufosc).end(30); + + 40.wait; + + Pbindef(\dustyLadder).stop; + +}; + +) \ No newline at end of file diff --git a/MELLOW_PULSES.scd b/MELLOW_PULSES.scd new file mode 100644 index 0000000..6a7027b --- /dev/null +++ b/MELLOW_PULSES.scd @@ -0,0 +1,127 @@ +// ---------------------------------------------------------------------------- +// MELLOW PULSES +( +~tf.stop; ~tf = fork{ loop{ TempoClock.default.tempo = 0.09.rand + 0.95; 1.wait; }} ; + +~fxFeedDelay1.set(\feedback, 0.8); +~fxJPverb1.set(\wet, 0.8); + +// load Pbinds +~mellow_pulses = Ppar([ + + Pbind(*[ type: \midi, midicmd: \noteOn, midiout: m, chan: 1, + amp: Ptuple([ Pwhite(0.6,0.9), Pwhite(0.6,0.9) ], inf) * Pseg([0.9, 0.76, 0.9], [0.1,59.9], \lin, inf), + legato: 1, + scale: Scale.minor, + dur: Pseq([5,6,4,7,3],inf), + degree:(0..7) * Pxrand((4..2), inf), + octave: Prand([[5,4,6],[4,5],[5,6],5],inf) - 1, + mtranspose: Prand([0,2,4],inf), + ctranspose: Plet(\ctrans, Pdup(8, Pseq([0, -5, 2, -3, 4, -1], 1) - 1)), + ]), + + Pbind(*[ instrument: \pulseTriSaw, + amp: Pseg([0.6, 0.9, 0.6], 60, \lin, inf) * 1, + legato: 0.1, + scale: Scale.minor(\pythagorean), + dur:1.5, + degree: 0, + octave: 6, + sawamp: Pseg([0,1,0],50,\lin,inf), + atk:0, + dec:0.2, + sus:0.3 * Pseg([0,1,0], 40, \sqr, inf), + rls:5, + lpf: Pseg([3,20,3],40,\sqr, inf), //Pwhite(3,20), + pan:Pwhite(-1,1), + out: ~fxJPverbBus1, + ctranspose: Pget(\ctrans, default:0, repeats: 8 * 6 * 1 * (5/1.5)) + ]), + + Pbind(*[ instrument: \softSaw, + scale: Scale.minor(\pythagorean), + dur:6, + attackTime: 3, + releaseTime: 3, + legato: 1.2, + degree: Pseq([0,3], inf) + [0,4], + octave: 3, + amp: 0.09 * Pseg([0,0,1,1,0],60,\sqr), + out: ~fxFeedDelayBus1, + ctranspose: Pget(\ctrans, default:0, repeats: 144) ]) + +]); + +fork { + + "--- start chords, pulses and deep soft Saw ... ".postln; + ~mpulses = Plambda( ~mellow_pulses).play(quant:1); + + 120.wait; + + "--- start glitches ... ".postln; + Pbindef(\glitch2, *[ + instrument: \smpPlay, + bufnum: Pdup(1,Pxrand([ + ~getSmp.("Loop_049"), ~getSmp.("Loop_048"), ~getSmp.("Loop_050"), + ~getSmp.("Loop_053"), ~getSmp.("Loop_052"), ~getSmp.("Loop_047") + ],inf)), + + legato:Pwhite(0,0.2), + spos: Pwhite(0.1,2.5), + dur:Pn(6, 20), + pan:Pwhite(-1.0,1.0), + amp:0.08, + out: 0, // ~fxFeedDelayBus1, + lpffreq: 14000, hpffreq: 500, + ] + ).play(quant:2); + + 120.wait; + + "end. ".postln; + +} + +) + + + + + + + + + + + + + + + + + + + + + + +( + Pbind(*[ instrument: \pulseTriSaw, + amp: Pseg([0.6, 0.9, 0.6], 60, \lin, inf) * 1, + legato: 0.1, + scale: Scale.minor(\pythagorean), + dur:1.5, + degree: 0, + octave: 6, + sawamp: Pseg([0,1,0],50,\lin,inf), + atk:0, + dec:0.2, + sus:0.3 * Pseg([0,1,0], 40, \sqr, inf), + rls:5, + lpf: Pseg([3,20,3],40,\sqr, inf), //Pwhite(3,20), + pan:Pwhite(-1,1), + out: ~fxJPverbBus1, + // ctranspose: Pget(\ctrans, default:0, repeats: 8 * 6 * 1 * (5/1.5)) + ]).stop +) diff --git a/SINODA_LULLABY.scd b/SINODA_LULLABY.scd new file mode 100644 index 0000000..ea3d0d8 --- /dev/null +++ b/SINODA_LULLABY.scd @@ -0,0 +1,235 @@ +// ---------------------------------------------------------------------------- +// SINODA LULLABY + +( +~tf.stop; ~tf = fork { loop { TempoClock.default.tempo = 0.15.rand + 1; 1.wait; }}; + +~fxFeedDelay1.set(\feedback, 0.7); +~fxFeedDelay1.set(\amount, 0.6); + +fork { + + ">>> routine start...".postln; + + "--- triSinSquare bliss...".postln; + Pbindef(\sinoL, *[ + instrument: \triSinSquare, + dur: Pseq([1, 1/2, 1/2, 1/4, 1/4, 1/2, Pn(1/3,3)], inf) , + scale: Scale.minor(\just), + legato: 0.01, + rls:4, + dec: 0.01, + atk:0.001, + sus:0.1, + sqamp: Pwhite(0,1), + pan:Pwhite(-1,1, inf), + octave:[4,5], + degree: Pseq([0,3,4,8],inf), + amp: 0.3 * Pseq([ + Pseg([0,1],36,\sqr), + Pseg([1,0.7,1],24,\sqr,inf) + ]), + mtranspose: Pdup(8,Pseq([3,0,4,-2],inf)) + [0,3], + lpf: Pseg([1,7,1],18,\exp,inf), //Pexprand(1, 10,inf) + ctranspose: 0, + outBus: ~fxFeedDelayBus1 + ]).play(quant:3); + + 60.wait; + + "--- chords each 3 beats".postln; + Pbindef(\sinoLpiano, *[ type: \midi, midicmd: \noteOn, midiout: m, chan: 1, + scale: Scale.minor, + legato: 2, //Pwhite(0.5, 1) * Pseg([0.5, 2, 0.5], 30, \lin, inf), + amp: Ptuple([ Pwhite(0.6,0.9), Pwhite(0.6,0.9), Pwhite(0.6,0.9) ], inf) + * Pseg([0.5, 0.8, 0.6], 50, \lin, inf), + dur: 3, + degree: Pseq([[0,2,4],[0,8,4,3],Prand([[0,2,4],[0,8,4,3]])],inf), + octave: [6,5,4,7]-1, + mtranspose: Pdup(4, Pseq([3, 3, 0, 4],inf)), + ctranspose: 0 + ]).play(quant:3); + + 36.wait; + + "--- dominant each 1.5 beats".postln; + Pbindef(\sinoLpianoS, *[ type: \midi, midicmd: \noteOn, midiout: m, chan: 1, + scale: Scale.minor, + legato: 2, + amp: Pwhite(0.6,0.9) * Pseg([0.5, 0.8, 0.4], 30, \lin, inf), + dur: 1.5, + // degree: [0,2,4,8,9,11,13,15], + degree: 0, + octave: Prand([5,6,7],inf), + ctranspose: 0 + ]).play(quant:3); + + "--- recording, granulating...".postln; + ~recBmono = Synth(\recBufMono, [\bufnum, ~pBufMono1, \loop, 1], addAction: \addToTail); + ~mpulseGran = Synth(\gran, [\out, ~fxJPverbBus1, \buffer, ~pBufMono1, \atk, 30, \amp, 0.1]); + + 72.wait; + + "--- stopping...".postln; + Pbindef(\sinoL).stop; + Pbindef(\sinoLpiano).stop; + Pbindef(\sinoLpianoS).stop; + ~mpulseGran.release(6); + + 3.wait; + + "--- ctranspose: -5.".postln; + ~ctranspose = -5; // 0, 5, -2, 3, -4, 1, -6, -1, 4, -3 ? + Pbindef(\sinoL, *[ ctranspose: ~ctranspose, amp: 0.2 * Pseg([0,0,1],36,\sqr) ] ).play(quant:3); + Pbindef(\sinoLpiano, *[ ctranspose: ~ctranspose ]).play(quant:3); + Pbindef(\sinoLpianoS, *[ ctranspose: ~ctranspose ]).play(quant:3); + + 3.wait; + + ~mpulseGran = Synth(\gran, [\out, ~fxJPverbBus1, \buffer, ~pBufMono1, \atk, 30, \amp, 0.1]); + + 69.wait; + + "--- stopping...".postln; + Pbindef(\sinoL).stop; + Pbindef(\sinoLpiano).stop; + Pbindef(\sinoLpianoS).stop; + ~mpulseGran.release(6); + + 3.wait; + + "--- ctranspose: 2".postln; + ~ctranspose = 2; // 0, 5, -2, 3, -4, 1, -6, -1, 4, -3 ? + Pbindef(\sinoL, *[ ctranspose: ~ctranspose, amp: 0.2 * Pseg([0,0,1],36,\sqr) ] ).play(quant:3); + Pbindef(\sinoLpiano, *[ ctranspose: ~ctranspose ]).play(quant:3); + Pbindef(\sinoLpianoS, *[ ctranspose: ~ctranspose ]).play(quant:3); + + 3.wait; + + ~mpulseGran = Synth(\gran, [\out, ~fxJPverbBus1, \buffer, ~pBufMono1, \atk, 30, \amp, 0.15]); + + 69.wait; + + "--- stopping...".postln; + Pbindef(\sinoL).stop; + Pbindef(\sinoLpiano).stop; + Pbindef(\sinoLpianoS).stop; + ~mpulseGran.release(6); + + + 3.wait; + + "--- ctranspose: -3.".postln; + ~ctranspose = -3; // 0, 5, -2, 3, -4, 1, -6, -1, 4, -3 ? + Pbindef(\sinoL, *[ ctranspose: ~ctranspose, amp: 0.3 * Pseg([0,1,1], 72, \sqr) ] ).play(quant:3); + Pbindef(\sinoLpiano, *[ ctranspose: ~ctranspose ]).play(quant:3); + Pbindef(\sinoLpianoS, *[ ctranspose: ~ctranspose ]).play(quant:3); + + 3.wait; + + ~mpulseGran = Synth(\gran, [\out, ~fxJPverbBus1, \buffer, ~pBufMono1, \atk, 30, \amp, 0.2]); + + 69.wait; + + "--- fade sinoL... ".postln; + Pbindef(\sinoL, *[amp: Pseg([0.4,0], 30, \sqr)]); + + 73.wait; + + "--- stop piano and recording ...".postln; + ~recBmono.free; + Pbindef(\sinoLpiano).stop; + Pbindef(\sinoLpianoS).stop; + + 36.wait; + + "--- release granulator.".postln; + ~mpulseGran.release(24); + + 24.wait; + + ">>> routine end".postln; + +} +) + +////////////////////////////////////////////////////////////////////////////// + + + + + + + +/* + + + + +( +( (0..11) * 7 ).mod(12)-12.postln; + +) + +( + Pbindef(\sinoL).stop; + Pbindef(\sinoLpiano).stop; + Pbindef(\sinoLpianoS).stop; + +6.wait; + + Pbindef(\sinoL).stop; + Pbindef(\sinoLpiano).stop; + Pbindef(\sinoLpianoS).stop; + + +( +~ctranspose = 3; // 0, 5, -2, 3, -4, 1, -6, -1, 4, -3 ? +Pbindef(\sinoL, *[ ctranspose: ~ctranspose ]); +Pbindef(\sinoLpiano, *[ ctranspose: ~ctranspose ]); +Pbindef(\sinoLpianoS, *[ ctranspose: ~ctranspose ]); +) + + +~ctranspose = 0; // 0, 5, -2, 3, -4, 1, -6, -1, 4, -3 ? +Pbindef(\sinoL, *[ ctranspose: ~ctranspose ]); +Pbindef(\sinoLpiano, *[ ctranspose: ~ctranspose ]); +Pbindef(\sinoLpianoS, *[ ctranspose: ~ctranspose ]); +) + +// record // loop? + +// granulate +~mpulseGran = Synth(\gran, [\out, ~fxJPverbBus1, \buffer, ~pBufMono1, \atk, 30, \amp, 0.2]); +~mpulseGran.set(\amp, 0.3) + + +( +~ctranspose = 0; // 0, 5, -2, 3, -4, 1, -6, -1, 4, -3, 2, -5, 0? +Pbindef(\sinoL, *[ ctranspose: ~ctranspose ]); +Pbindef(\sinoLpiano, *[ ctranspose: ~ctranspose ]); +Pbindef(\sinoLpianoS, *[ ctranspose: ~ctranspose ]); +//Synth(\recBufMono, [\bufnum, ~pBufMono1], addAction: \addToTail); +) + +Pbindef(\sinoL).stop +( +Pbindef(\sinoL).clear; +Pbindef(\sinoLpiano).clear; +Pbindef(\sinoLpianoS).clear; +) +Pbindef(\sinoL, *[amp: Pseg([0.4,0],30, \sqr)]) + +m.control(1, ctlNum: 64, val: 127) +~mpulseGran.release(10) +Pbindef(\sinoLpianoS).stop +Pbindef(\sinoLpianoS).clear +m.control(1, ctlNum: 64, val: 0) + + +///////////////////////////////////////////////////////// +~mpulseGran.free +~pBufMono1.plot + +// STOP +*/ \ No newline at end of file diff --git a/lib/00-funcs.scd b/lib/00-funcs.scd new file mode 100644 index 0000000..064898b --- /dev/null +++ b/lib/00-funcs.scd @@ -0,0 +1,6 @@ +// function to partially match filename for buffers +~getSmp = { |regexp| + ~granBfr.detect { |buf| + regexp.matchRegexp(buf.path) + } +}; diff --git a/lib/01-sdefs.scd b/lib/01-sdefs.scd new file mode 100644 index 0000000..0b2123f --- /dev/null +++ b/lib/01-sdefs.scd @@ -0,0 +1,463 @@ +// ----------------------------------------------------------------------- + +// recorders + +SynthDef(\recBufMono, { + arg bufnum = 0, loop = 0, in=0; + + RecordBuf.ar( SoundIn.ar(in), + bufnum, doneAction: Done.freeSelf, loop: loop); +}).add; + + +SynthDef(\recBufStereo, { + arg bufnum = 0, loop = 0; + + RecordBuf.ar( SoundIn.ar([0,1]), + bufnum, doneAction: Done.freeSelf, loop: loop); +}).add; + +// ex: +// Synth(\recBufMono, [\bufnum, ~pBufMono1], addAction: \addToTail); +// Synth(\recBufStereo, [\bufnum, ~pBuf1], addAction: \addToTail); + +// sound generators and players // + +SynthDef("gran", + { + arg out = 0, buffer = 0, amp = 1, gate = 1, atk = 10, rls = 10; + var snd = GrainBuf.ar(2, + trigger: Impulse.ar(LFNoise1.kr(1/10!3).exprange(80, 180) + * LFNoise0.ar(100).range(0.7,1.1)), + dur: LFNoise1.ar(1).range(0.08,0.1), + //sndbuf: ~pBufMono1, + sndbuf: buffer, + //rate:[1,1/2,1/4], + rate:[1,1/2,1/4,2], + pos:LFNoise1.kr(1/20!3).range(0,1), + pan: LFNoise0.ar(100).range(-1,1) + ); + snd = LPF.ar(snd, LFNoise1.kr(1/10!3).exprange(500,10000)); + snd = Splay.ar(snd); + snd = Limiter.ar(snd, 0.8); + snd = snd * LFPulse.kr(8).range(LFNoise1.kr(1/5).range(0.3,1),1); + snd = snd * EnvGen.ar(Env.asr( atk, 1, rls, \sqr ), gate, doneAction: Done.freeSelf); + snd = snd * Lag3.kr(amp, 10); + + Out.ar(out, snd); + } +).add; + + +SynthDef("smpPlay", + { + arg out = 0, gate = 1, amp = 0.6, pan = 0, rls = 0.01, + bufnum = 0, rate = 1, spos = 0, lpffreq=18000, hpffreq=20; + var snd, env; + + env = EnvGen.ar(Env.cutoff(rls), gate, doneAction: Done.freeSelf); + snd = PlayBuf.ar(1, bufnum, rate, gate, spos * SampleRate.ir ); + snd = LPF.ar(snd, lpffreq); + snd = HPF.ar(snd, hpffreq); + snd = Pan2.ar(snd, pan); + Out.ar(out, snd * amp); + } +).add; + +// darksaw // ------------------------------------------------------ +// "--- dark saw synthdef...".postln; +SynthDef(\softSaw, + { + arg out = 0, freq = 40, oscdetune = 0.1, amp = 1, pan = 0, + gate = 1, attackTime = 0.1, susLevel = 1.0, releaseTime = 1.0, gainBus; + var env, snd; + oscdetune = oscdetune * 0.1; + amp = amp * 0.4; + + env = Linen.kr(gate, attackTime, susLevel, releaseTime, doneAction:2); + + snd = VarSaw.ar( + freq: [freq, freq * (1.003 + oscdetune)], + width: SinOsc.kr(0.01,0.2).range(0.05,0.095)); + snd = snd + VarSaw.ar( + freq: [(freq*2 * (1.001 - oscdetune)),(freq*2 * (1 + oscdetune))], + width: SinOsc.kr(0.06,0.8).range(0.2,0.8)); + snd = Balance2.ar(snd.at(0), snd.at(1), pos: pan); + snd = snd * amp * env ; + OffsetOut.ar(out, snd); + } +).add; + + +SynthDef(\akjPad, + { + arg freq=300, amp=0.1, out=0, gate=1, atk=2, rls=2; + var snd, env, cutoff; + + cutoff = freq * 5; + freq = [freq,freq*1.01]; + freq = freq * SinOsc.kr([4.333,8], mul:0.005, add:1); + snd = LFPar.ar(freq) * 0.3 + + (LFTri.ar(freq, mul:0.3)) + + (Pulse.ar(freq, mul:2)) + + (SinOsc.ar(freq, mul:4).clip2(0.3)); + snd = snd.clip2(0.9); + snd = snd * LFPulse.kr(LFNoise1.kr(1/8).range(2,20)).range(0.6,1); + snd = snd * LFPulse.kr(LFNoise0.kr(1/8).range(2,20)).range(0.6,1); + snd = RLPF.ar( snd, + freq: cutoff * SinOsc.ar([0.3,0.4]).range(0.8,1.2), + rq: SinOsc.ar([0.4,0.3]).range(0.5,0.2) ); + snd = snd + CombC.ar(snd, + delaytime: SinOsc.kr(1/25, [0, pi/2]).range(0.1,0.2), + mul:0.6); + env = EnvGen.kr( Env([0,1,0], [atk, rls], \cub, 1 ), gate, doneAction:2); + snd = Splay.ar(snd); + snd = snd * env * amp; + + Out.ar(out, snd); + } +).add; + + + + +// a pretty good synth, once reworked. +// upgraded from SCLOrkSynths/.../SynthDefs/pads/sawSynth.scd +SynthDef("sawSquareSynth", + { + arg out = 0, freq = 200, amp = 0.1, + att = 0.1, rel = 2, gate = 1, pan = 0, + cutoff = 1, ssratio = 0.5; + var env, snd, loff, hiff; + + cutoff = (freq * cutoff).max(40).min(20000); + env = EnvGen.kr(Env.asr( + attackTime: att, + sustainLevel: amp, + releaseTime: rel), gate, doneAction: 2); + snd = Saw.ar(freq: freq * [0.99, 1, 1.001, 1.008], mul: env * ssratio); + snd = snd + Pulse.ar(freq: freq * [1, 0.985, 1.007, 1.002], mul: env * (ssratio.neg + 1)); + snd = LPF.ar( + in: snd, + freq: cutoff ); + snd = Mix.ar(snd) * 0.2; + snd = Pan2.ar(snd, pan); + Out.ar(out, snd); + }).add; + + +SynthDef(\padVib, + { + arg + //Standard Values: + out = 0, pan = 0, freq = 400, amp = 0.5, att = 0.4, dec = 0.5, sus = 0.8, rel = 1.0, gate = 1, + //Other Controls: + vibratoRate = 4, vibratoDepth = 0.01, tremoloRate = 8, + //These controls go from 0 to 1: + tremoloDepth = 0.5, reverbMix = 0.5, roomSize = 1, damp = 0.5; + + var env, snd, vibrato, tremolo, mod2, mod3; + + env = Env.adsr(att, dec, sus, rel).kr(gate: gate); + vibrato = SinOsc.kr(vibratoRate).range(freq * (1 - vibratoDepth), freq * (1 + vibratoDepth)); + tremolo = LFNoise2.kr(1).range(0.2, 1) * SinOsc.kr(tremoloRate).range((1 - tremoloDepth), 1); + + snd = SinOsc.ar(freq: [freq, vibrato], mul:(env * tremolo * amp)).distort; + snd = Mix.ar([snd]); + //snd = FreeVerb.ar(snd, reverbMix, roomSize, damp); + + DetectSilence.ar(snd, 0.0001, 0.2, doneAction: 2); + Out.ar(out, Pan2.ar(snd, pan)); + }, + metadata:( + credit: "Mike Hairston", + tags: [\pad, \vibrato, \sustained] + ) +).add; + + +SynthDef(\fm5, + { + arg f=10, i=0.1, gate=1, freq=120, amp=0.1, out=0, + atk=0.01, dec=0.1, sus=0.5, rls=5; + var c, m, d, snd; + + c = freq; + m = c * f; + d = m / i; + snd = SinOsc.ar( c + SinOsc.ar(m, mul: d) ); + snd = LPF.ar(snd, 18000); + snd = snd * EnvGen.ar(Env.adsr(atk, dec, sus, rls, curve:-10), gate, doneAction:2); + + Out.ar(out, snd!2 * amp * 3); + } +).add; + + +SynthDef(\pulseTriSaw, + { + arg out = 0, freq=440, gate=1, amp=0.1, pan = 0, sawamp = 0.1, + atk = 0.01, dec = 0.1, sus = 0.5, rls = 0.3, lpf=1 ; + var snd; + + freq = freq * SinOsc.kr(4).range(0.998,1.002); + snd = Pulse.ar(freq) + LFTri.ar(freq / Rand(1.99,2.01)) + + Saw.ar(freq * Rand(1.99,2.01), mul:sawamp); + lpf = (freq * lpf).min(20000).max(40); + snd = LPF.ar(snd, lpf); + snd = [snd, DelayN.ar(snd, 0.1, 0.009)]; + snd = snd * EnvGen.kr(Env.adsr(atk, dec, sus, rls), gate, doneAction:Done.freeSelf); + snd = snd * amp * 0.1; + snd = Balance2.ar(snd[0], snd[1], pan); + + Out.ar(out, snd); + } +).add; + + +SynthDef(\triSinSquare, + { + arg outBus = 0, freq=440, gate=1, amp=0.1, pan = 0, + atk = 0.01, dec = 0.1, sus = 0.5, rls = 0.3, + sqamp = 0.1, lpf=1 ; + var snd; + + freq = freq * SinOsc.kr(4).range(0.998,1.001); + snd = LFTri.ar(freq) + + SinOsc.ar(freq * Rand(1.99,2.01)) + + Pulse.ar(freq / Rand(1.99,2.01), mul:sqamp); + lpf = (freq * lpf).min(20000).max(40); + snd = LPF.ar(snd, lpf); + snd = [snd, DelayN.ar(snd, 0.1, 0.001)]; + snd = snd * EnvGen.kr( + Env.adsr(atk, dec, sus, rls), + gate, doneAction:Done.freeSelf); + snd = snd * amp * 0.5; + snd = Balance2.ar(snd[0], snd[1], pan); + + Out.ar(outBus, snd); + } +).add; + + +SynthDef(\akjBaz, + { + arg freq=300, amp=0.1, out=0, gate=1, + rls=0.01, atk=0.01, cutoff=10, rq=0.5; + var snd, env; + + snd = SinOsc.ar(freq, [0, pi/2.5], mul:0.7); + snd = snd * Lag.ar(LFPulse.ar(freq/2.005, 0.5).range(1,0),0.005); + snd = snd.softclip(0.5) * 1.5 ; + snd = RLPF.ar(snd, cutoff * freq, rq ); + env = Linen.kr(gate, atk, amp, rls, 2); + snd = snd * env; + Splay.ar(snd); + + Out.ar(out, snd); + } +).add; + + +SynthDef(\akjClick, + { + arg out=0, gate=1, freq=440, amp=0.1, releaseTime=0.1; + var snd, env; + + snd = LFPulse.ar([freq, freq * 2], width: LFNoise1.ar(0.1).exprange(0.001,0.004)); + snd = snd + (WhiteNoise.ar(1) * snd); + snd = HPF.ar(snd, 200); + env = EnvGen.ar(Env.perc(0,releaseTime)); + snd = snd * env * amp * Linen.kr(gate, 0, 1, releaseTime, 2); + snd = Splay.ar(snd); + + Out.ar(out, snd); + } +).add; + + +SynthDef(\dusty, + { + arg out = 0, amp = 0.1, gate = 1, pan = 0, + atk = 0.1, rls = 0.1, density = 10; + var snd, env; + + snd = Dust2.ar(density); + env = EnvGen.ar(Env.asr(atk, amp, rls), gate, doneAction:2); + snd = Pan2.ar(snd * env, pan); + + Out.ar(out, snd); + } +).add; + + +SynthDef( \dustyPinkClip, + { + arg out = 0, amp = 0.7, gate = 1, pan = 0, + atk = 0.1, rls = 0.1, + density = 10, maxrls = 0.2; + var dust, env, snd; + + dust = Dust2.ar(density); + env = EnvGen.ar(Env.asr(atk, amp, rls), gate, doneAction:2); + snd = PinkNoise.ar + ClipNoise.ar(0.3); + snd = snd * EnvGen.ar( + Env.perc(0, LFNoise0.kr(10).exprange(0.0001, 0.2)), dust); + snd = HPF.ar(snd, LFNoise0.kr(10!2).exprange(100,500)); + snd = LPF.ar(snd, LFNoise0.kr(10!2).exprange(500,15000)); + snd = Pan2.ar(snd[0], LFNoise0.kr(5).range(-1,1)) + + Pan2.ar(snd[1], LFNoise0.kr(5).range(-1,1)); + snd = Balance2.ar(snd[0], snd[1], pan); + snd = snd * env; + + Out.ar(out, snd); + } +).add; + +SynthDef(\clipyPerc, + { + arg out = 0, amp = 0.7, gate = 1, pan = 0, + hpf = 40, lpf = 18000, + atk = 0, rls = 0.1; + var snd, env; + + hpf = hpf.max(40); + lpf = lpf.min(20000); + + env = EnvGen.ar(Env.linen(0, rls, 0, amp, -4), gate); + snd = ClipNoise.ar(0.5) + WhiteNoise.ar(0.5); + snd = HPF.ar(snd, hpf); + snd = LPF.ar(snd, lpf); + snd = Pan2.ar(snd * env, pan); + + Linen.kr(gate,0,1,0,2); // kill + Out.ar(out, snd); + } +).add; + + + + + + +// ----------------------------------------------------------------------- +// FX synthdefs // + +// reverb synthdef +SynthDef(\fxGverb, + { + arg in, out = 0, amp = 1, + dry = 1, early = 0.1, tail = 0.7, room = 100, decay = 3; + var snd, rev; + + snd = In.ar(in, 2); + snd = HPF.ar(snd, 100); + rev = GVerb.ar(snd, room, decay, + drylevel: dry, earlyreflevel: early, taillevel: tail); + + Out.ar(out, rev * amp); + } +).add; + + +// reverb synthdef +SynthDef(\fxJPverb, + { + arg in, out = 0, wet = 0.5, decay = 3, size = 1; + var snd, rev; + + snd = In.ar(in, 2); + snd = HPF.ar(snd, 100); + //rev = Greyhole.ar(snd, size: size, feedback: feedback) ; + rev = JPverb.ar(snd, decay, size: size) ; + rev = rev * wet; + + Out.ar(out, snd + rev); + } +).add; + + +// feedback delay w/ bandpass filter + stereo rotation +SynthDef(\fxFeedDelay, + { + arg in, out = 0, feedback = 0.9, time = 1, amount = 0.5; + var snd, input, local; + + time = time * {Rand(0.5,1.0)}.dup; + time = time.min(2).max(0.01); + + input = In.ar(in,2); + + local = LocalIn.ar(2) * feedback; + + local = BPF.ar(local, LFNoise1.kr(0.6).range(450,2000), LFNoise1.kr(0.1).range(0.8,1)); + local = Rotate2.ar(local[0], local[1], 0.23); + + local = AllpassN.ar(local, 1, time, 2); + //local = DelayN.ar(local, 0.3, [0.26,0.19]); + //local = AllpassN.ar(local, 0.05, {Rand(0.03,0.15)}.dup, 2); + + local = LeakDC.ar(local); + + local = local + input; + LocalOut.ar(local); + + Out.ar(out, local * amount + input); + } +).add; + +// delay wrangler +SynthDef(\fxDelayWarp, + { + arg out=0, in, wet=0.1; + var snd, dly2; + + snd = In.ar(in, 2); + dly2 = CombN.ar(HPF.ar(snd,300), 1, [0.5,0.77], 5, mul:LFNoise1.kr(0.1).range(0.8,0.3)); + snd = CombN.ar(snd, 1, Lag.ar(LFNoise0.ar(1/3).range(0.01,0.1),0.1), 3, mul:wet) + snd; + snd = Decimator.ar(snd, LFNoise1.kr(1).range(8000,22000), 0.2, 1.5) + (snd*0.5); + snd = AnalogTape.ar(snd, 1, 1); + snd = Compander.ar( + snd, snd, + thresh: 0.9, + slopeBelow: 1, + slopeAbove: 0.01, + clampTime: 0.01, + relaxTime: 0.01); + snd = BHiShelf.ar(snd, 3000, 0.2, 5); + Out.ar(out, snd); + } +).add; + + + + + + + + + + +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// +///////////////////////////////////////////////////////////////////////////////////////// \ No newline at end of file