From ec2b1b79986c5d59bebd53a4ea0e3be03fa2ec29 Mon Sep 17 00:00:00 2001 From: Eugene Petkevich Date: Sat, 6 Jan 2024 21:28:34 +0100 Subject: [PATCH] refactor synths into several files --- library/effects.scd | 21 +++++++++ library/{synths.scd => instruments.scd} | 42 ----------------- library/midi.scd | 62 ++++++++++++------------- library/mixer.scd | 19 ++++++++ startup.scd | 4 +- 5 files changed, 73 insertions(+), 75 deletions(-) create mode 100644 library/effects.scd rename library/{synths.scd => instruments.scd} (89%) create mode 100644 library/mixer.scd diff --git a/library/effects.scd b/library/effects.scd new file mode 100644 index 0000000..32a4686 --- /dev/null +++ b/library/effects.scd @@ -0,0 +1,21 @@ +// reverbs + +// JPverb with all parameters and mix +SynthDef(\qahe, {|in, out=0, mix=0, t60=1.0, damp=0.0, size=1.0, earlyDiff=0.707, modDepth=0.1, modFreq=2.0, low=1.0, + mid=1.0, high=1.0, lowcut=500.0, highcut=2000.0| + var sig, rev; + sig = In.ar(in, 2); + rev = JPverb.ar(sig, + t60: t60, + damp: damp, + size: size, + earlyDiff: earlyDiff, + modDepth: modDepth, + modFreq: modFreq, + low: low, + mid: mid, + high: high, + lowcut: lowcut, + highcut: highcut); + Out.ar(out, sig + (mix * rev)); +}).add; \ No newline at end of file diff --git a/library/synths.scd b/library/instruments.scd similarity index 89% rename from library/synths.scd rename to library/instruments.scd index 6038aa2..5664d39 100644 --- a/library/synths.scd +++ b/library/instruments.scd @@ -20,26 +20,6 @@ s.doWhenBooted{ }; */ -// routing and mastering - -/* masterer -~masterer = Synth(\masterer, ( - in: ~mainBus, - out: a.h, - amp: 1.0, - lookAheadTime: 0.05, -).asPairs, ~masterGroup); -*/ -SynthDef(\masterer, {arg in, out, - amp=1.0, - lookAheadTime=0.05 - ; - var sig; - sig = In.ar(in, 2) * amp; - sig = Limiter.ar(sig, level: 1.0, dur: lookAheadTime); - Out.ar(out, sig); -}).add; - // instruments // fm synth @@ -206,28 +186,6 @@ SynthDef(\ruse, { | gate = 1, freq = 55, amp=1, out=0 | Out.ar(out, sig * amp); }).add; -// reverbs - -// JPverb with all parameters and mix -SynthDef(\qahe, {|in, out=0, mix=0, t60=1.0, damp=0.0, size=1.0, earlyDiff=0.707, modDepth=0.1, modFreq=2.0, low=1.0, - mid=1.0, high=1.0, lowcut=500.0, highcut=2000.0| - var sig, rev; - sig = In.ar(in, 2); - rev = JPverb.ar(sig, - t60: t60, - damp: damp, - size: size, - earlyDiff: earlyDiff, - modDepth: modDepth, - modFreq: modFreq, - low: low, - mid: mid, - high: high, - lowcut: lowcut, - highcut: highcut); - Out.ar(out, sig + (mix * rev)); -}).add; - // generators ( diff --git a/library/midi.scd b/library/midi.scd index d2acc39..64366d4 100644 --- a/library/midi.scd +++ b/library/midi.scd @@ -1,40 +1,38 @@ ~midiup = { MIDIClient.init; MIDIIn.connectAll; -}; - -~midiup.value; -Platform.case( - \osx, { - try { - ~moutArdour1 = MIDIOut.newByName("IAC Driver", "Bus 1").latency_(s.latency); - ~moutArdour2 = MIDIOut.newByName("IAC Driver", "Bus 2").latency_(s.latency); - ~moutArdour3 = MIDIOut.newByName("IAC Driver", "Bus 3").latency_(s.latency); - ~moutArdour4 = MIDIOut.newByName("IAC Driver", "Bus 4").latency_(s.latency); - ~moutFl = MIDIOut.newByName("IAC Driver", "Bus 5").latency_(s.latency); - ~moutAbleton = MIDIOut.newByName("IAC Driver", "Bus 6").latency_(s.latency); - ~moutHydrogen = MIDIOut.newByName("IAC Driver", "Bus 7").latency_(s.latency); - ~mout8 = MIDIOut.newByName("IAC Driver", "Bus 8").latency_(s.latency); - } {|error| - "Cannot connect to macbook midi out".postln; - error.throw; - }; - }, - \linux, { }, - \windows, { } -); + Platform.case( + \osx, { + try { + ~moutArdour1 = MIDIOut.newByName("IAC Driver", "Bus 1").latency_(s.latency); + ~moutArdour2 = MIDIOut.newByName("IAC Driver", "Bus 2").latency_(s.latency); + ~moutArdour3 = MIDIOut.newByName("IAC Driver", "Bus 3").latency_(s.latency); + ~moutArdour4 = MIDIOut.newByName("IAC Driver", "Bus 4").latency_(s.latency); + ~moutFl = MIDIOut.newByName("IAC Driver", "Bus 5").latency_(s.latency); + ~moutAbleton = MIDIOut.newByName("IAC Driver", "Bus 6").latency_(s.latency); + ~moutHydrogen = MIDIOut.newByName("IAC Driver", "Bus 7").latency_(s.latency); + ~mout8 = MIDIOut.newByName("IAC Driver", "Bus 8").latency_(s.latency); + } {|error| + "Cannot connect to macbook midi out".postln; + error.throw; + }; + }, + \linux, { }, + \windows, { } + ); -m = ( - arout1: ~moutArdour1, - arout2: ~moutArdour2, - arout3: ~moutArdour3, - arout4: ~moutArdour4, - about: ~moutAbleton, - flout: ~moutFl, - hyout: ~moutHydrogen, - out8: ~mout8 -); + m = ( + arout1: ~moutArdour1, + arout2: ~moutArdour2, + arout3: ~moutArdour3, + arout4: ~moutArdour4, + about: ~moutAbleton, + flout: ~moutFl, + hyout: ~moutHydrogen, + out8: ~mout8 + ); +}; // hydrogen drum machine constants b = ( diff --git a/library/mixer.scd b/library/mixer.scd new file mode 100644 index 0000000..0f5277c --- /dev/null +++ b/library/mixer.scd @@ -0,0 +1,19 @@ +// routing and mastering + +/* masterer +~masterer = Synth(\masterer, ( + in: ~mainBus, + out: a.h, + amp: 1.0, + lookAheadTime: 0.05, +).asPairs, ~masterGroup); +*/ +SynthDef(\masterer, {arg in, out, + amp=1.0, + lookAheadTime=0.05 + ; + var sig; + sig = In.ar(in, 2) * amp; + sig = Limiter.ar(sig, level: 1.0, dur: lookAheadTime); + Out.ar(out, sig); +}).add; \ No newline at end of file diff --git a/startup.scd b/startup.scd index 7552f31..aa898d1 100644 --- a/startup.scd +++ b/startup.scd @@ -31,7 +31,9 @@ c = ( "./library/superclean.scd".loadRelative; // synths -"./library/synths.scd".loadRelative; +"./library/mixer.scd".loadRelative; +"./library/instruments.scd".loadRelative; +"./library/effects.scd".loadRelative; // recording -- 2.17.1