From: Eugene Petkevich Date: Sat, 13 Jan 2024 01:42:46 +0000 (+0100) Subject: add template for synthdef and for pdef / add additional recorder X-Git-Url: https://git.zuelum.org/?a=commitdiff_plain;h=7f2193d4a5626f55274e426466fd24d4193c512b;p=scprojects.git add template for synthdef and for pdef / add additional recorder --- diff --git a/library/template.scd b/library/template.scd index 7a6abac..cb50d5d 100644 --- a/library/template.scd +++ b/library/template.scd @@ -7,11 +7,13 @@ ~effectGroup = Group.after(~instrumentGroup); ~masterGroup = Group.after(~effectGroup); + ~fagiGroup = Group.tail(~instrumentGroup); + ~mainBus = Bus.audio(s, 2); ~masterer = Synth(\masterer, ( in: ~mainBus, out: a.h, - amp: 0.5, + amp: -60.dbamp, lookAheadTime: 0.05, ).asPairs, ~masterGroup); }; @@ -28,7 +30,54 @@ ServerBoot.add(~drawWindows); // recording ( -s.recorder.filePrefix = "test"; +~r = Recorder(s); +s.recorder.filePrefix = "test_main_"; +~r.filePrefix = "test_master_"; s.record(bus: ~mainBus); +~r.record(bus: a.h); +) +( +s.stopRecording; +~r.stopRecording; +) + +// synthdefs + +( +SynthDef(\fagi, { arg + out=0, + amp=1, + relAmp=1, // for controlling volume of a set of synths + pan=0, + t_trig=1, + gate=1, + freq=440, doneAction=2, cut=800, rez=0.8, + modFreqMin=7, modFreqMax=12, modAmp=0.01, release=1.0 + ; + var sig = 0; + var panDelay = 0.005; + var modFreq = SinOsc.kr(Rand(modFreqMin, modFreqMax), 0, modAmp, 1); + sig = sig + Pulse.ar(freq * modFreq); + sig = RLPF.ar(sig, cut, rez); + sig = sig * EnvGen.ar(Env.asr(releaseTime: release), gate, doneAction: doneAction); + sig = Pan2.ar(sig, pan); + sig = [DelayN.ar(sig[0], panDelay, (panDelay*pan).clip(0, 1)), DelayN.ar(sig[1], panDelay, (panDelay.neg*pan).clip(0, 1))]; + Out.ar(out, sig * amp * relAmp); +}).add; +) + +// pdefs + +( +Pdef(\fagi, Pbind(*[ + group: ~fagiGroup, + out: ~mainBus, + instrument: \fagi, + db: 40, + pan: 0, + trig: 1, +])).quant_(4); ) -s.stopRecording; \ No newline at end of file + +Pdef(\fagi).play; +Pdef(\fagi).stop; \ No newline at end of file