refactor startup into more files
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Sat, 6 Jan 2024 20:13:31 +0000 (21:13 +0100)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Sat, 6 Jan 2024 20:17:51 +0000 (21:17 +0100)
library/serveroptions.scd [new file with mode: 0644]
library/setup.scd [new file with mode: 0644]
library/superclean.scd [new file with mode: 0644]
library/synths.scd
startup.scd
temp.scd

diff --git a/library/serveroptions.scd b/library/serveroptions.scd
new file mode 100644 (file)
index 0000000..552bbd7
--- /dev/null
@@ -0,0 +1,51 @@
+// Server setup
+
+/*
+ServerOptions.outDevices;
+ServerOptions.inDevices;
+*/
+
+s.options.outDevice = "Aggregate Device";
+
+//s.options.outDevice = "MA WFRIENDZ";
+//s.options.outDevice = "MacBook Air Speakers";
+//s.options.outDevice = "External Headphones";
+//s.options.outDevice = "EDIFIER R1080BT";
+//s.options.outDevice = "Scarlett 2i4 USB";
+//s.options.outDevice = "Bose Mini II SE SoundLink";
+
+s.options.inDevice = "Aggregate Device";
+
+//s.options.inDevice = "MacBook Air Microphone";
+//s.options.inDevice = "Scarlett 2i4 USB";
+//s.options.inDevice = "Scarlett Solo USB";
+
+s.options.hardwareBufferSize = 64;
+
+s.doWhenBooted{
+  s.latency = 0.4;
+};
+
+s.options.maxNodes = 128 * 1024;
+s.options.maxSynthDefs = 32 * 1024;
+s.options.memSize = 1024 * 1024;
+s.options.numBuffers = 32 * 1024;
+s.options.numAudioBusChannels = 32 * 1024;
+s.options.numControlBusChannels = 256 * 1024;
+s.options.numInputBusChannels = 17;
+s.options.numOutputBusChannels = 20;
+s.options.numWireBufs = 256;
+
+s.recHeaderFormat = "wav";
+
+Platform.case(
+  \osx, {
+    "Macos detected".postln;
+    thisProcess.platform.recordingsDir = "/Users/genio/stock/audio/supercollider";
+  },
+  \linux,     {
+    "Linux detected".postln;
+    thisProcess.platform.recordingsDir = "/home/genio/stock/audio/supercollider"
+  },
+  \windows,   { "Windows detected".postln }
+);
\ No newline at end of file
diff --git a/library/setup.scd b/library/setup.scd
new file mode 100644 (file)
index 0000000..7d044a3
--- /dev/null
@@ -0,0 +1,2 @@
+// server setup before server starts
+
diff --git a/library/superclean.scd b/library/superclean.scd
new file mode 100644 (file)
index 0000000..0d6f8ad
--- /dev/null
@@ -0,0 +1,16 @@
+// superclean setup
+
+~setup[\superclean] = false;
+
+s.doWhenBooted{
+  if(~setup[\superclean]) {
+    "WWWWW".postln;
+    ~clean = SuperClean(2, s);
+    ~clean.loadSoundFiles; // hot swap in samples from anywhere!
+    //~clean.loadSoundFiles("~/gart/media/Хахомо");
+    s.sync; // optionally: wait for samples to be read
+    ~clean.start([18]); // first 8 out looks like [0,2,4,6]
+    SuperClean.default = ~clean;
+    "[ SuperClean up + running ]".postln;
+  } {};
+};
\ No newline at end of file
index 83bfec3..6038aa2 100644 (file)
@@ -1,7 +1,214 @@
 // This file contains synthesisers
 
+// change default synthdef
+// https://github.com/supercollider/supercollider/blob/23ec13a5a2610b0af3755f053611142c7faea875/SCClassLibrary/Common/Collections/Event.sc#L164
+/*
+s.doWhenBooted{
+  SynthDef(\default, { arg
+    out=0,
+    freq=440,
+    amp=0.1,
+    pan=0,
+    gate=1;
+    var z;
+    z = LPF.ar(
+      Mix.new(VarSaw.ar(freq + [0, Rand(-0.4,0.0), Rand(0.0,0.4)], 0, 0.3, 0.3)),
+      XLine.kr(Rand(4000,5000), Rand(2500,3200), 1)
+    ) * Linen.kr(gate, 0.01, 0.7, 0.3, 2);
+    OffsetOut.ar(out, Pan2.ar(z, pan, amp));
+  }, [\ir]).add;
+};
+*/
+
+// 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
+SynthDef(\bino, {|
+  out=0, gate=1, freq=440, modFreq=440, amp=1, release=1.0, maxIndex=1
+  |
+  var sig, modIndex, env;
+  env = EnvGen.ar(Env.asr(releaseTime: release), gate, doneAction: 2);
+  modIndex = (1 - env) * maxIndex;
+  sig = PMOsc.ar(freq, modFreq, modIndex, mul: amp);
+  sig = sig * env;
+  sig = Pan2.ar(sig, Rand(-0.3, 0.3));
+  Out.ar(out, sig * amp);
+}).add;
+
+// snare drum 808 continuous
+SynthDef(\buti, {|out=0, amp=1, pan=0, t_trig=0, accent=0.1, freq=200, tone=0.5, decay=0.5, snappy=0.5|
+  var sig;
+  sig = AnalogSnareDrum.ar(
+    t_trig,
+    infsustain: 0.0,
+    accent: accent,
+    freq: freq,
+    tone: tone,
+    decay: decay,
+    snappy: snappy,
+  ) * amp;
+  sig = Pan2.ar(sig, pan);
+  Out.ar(out, sig);
+}).add;
+
+// fm-synth pulse
+SynthDef(\dire, { |amp=1, out=0, freq=440, gate=1|
+  var sig, modFreq, env;
+  modFreq = SinOsc.ar(3000, mul: freq/4, add: freq);
+  sig = Pulse.ar(modFreq);
+  env = EnvGen.ar(Env.adsr(), gate, doneAction: 2);
+  sig = sig * env;
+  sig = Pan2.ar(sig, Rand(-0.5, 0.5));
+  Out.ar(out, sig * amp);
+}).add;
+
+// Subtract synth pad
+SynthDef(\dyti, {
+  | out=0, gate=1, freq=440, amp=1, pan=0, 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);
+}).add;
+
+// additive sin synth, sounds like metal
+SynthDef(\leto, { |freq = 440, sustain = 1, amp=1, out=0|
+  var sig = 0;
+  var num = 26;
+  var partial = 0;
+  num.do({
+    var pfact = ExpRand(1, 16);
+    partial = SinOsc.ar(freq * pfact, Rand(0, 2pi)) / num / pfact;
+    partial = partial * EnvGen.kr(Env.perc(0.03, Rand(sustain/5, sustain)));
+    partial = Pan2.ar(partial, Rand(-0.5, 0.5));
+    sig = sig + partial;
+  });
+  sig = sig * Line.kr(1, 1, sustain+0.1, doneAction: 2);
+  Out.ar(out, sig*amp);
+}).add;
+
+// round membrane drum continuous
+SynthDef(\liwe, {|out=0, amp=1, pan=0, t_trig=0, tension=0.05, loss=0.99999, impact=0.1|
+  var sig, excitation;
+  excitation = EnvGen.kr(Env.perc, t_trig, timeScale: impact, doneAction: 0);
+  excitation = excitation * PinkNoise.ar();
+  sig = MembraneCircle.ar(excitation, tension, loss, mul: amp);
+  sig = Pan2.ar(sig, pan);
+  Out.ar(out, sig);
+}).add;
+
+// Subtract synth drum
+SynthDef(\naje, {
+  | out=0, sustain=0.5, freq=440, amp=1, cut=800, rez=0.8,
+    modFreqMin=7, modFreqMax=12, modAmp=0.01 |
+  var sig = 0;
+  var modFreq = SinOsc.kr(Rand(modFreqMin, modFreqMax), 0, modAmp, 1);
+  sig = sig + Pulse.ar(freq * modFreq);
+  sig = RLPF.ar(sig, cut.lag(0.01), rez.lag(0.01));
+  sig = sig * EnvGen.ar(Env.perc(0.005, releaseTime: sustain), doneAction: 2);
+  sig = Pan2.ar(sig, Rand(-0.3, 0.3));
+  Out.ar(out, sig * amp);
+}).add;
+
+// fibonacci organ
+SynthDef.new(\neta, { arg freq = 440, amp = 1.0, gate = 1, out = 0;
+  var shape = Env.adsr(0.1, 0.2, 0.7, 0.5, 1.0, -4.0, 0);
+  var fb = 1.0;
+  var ss = SinOscFB.ar(freq, fb, amp)
+    + SinOscFB.ar(freq*2, fb, amp/2)
+    + SinOscFB.ar(freq*3, fb, amp/3)
+    + SinOscFB.ar(freq*5, fb, amp/5)
+    + SinOscFB.ar(freq*8, fb, amp/8)
+    + SinOscFB.ar(freq*13, fb, amp/13)
+    + SinOscFB.ar(freq*21, fb, amp/21)
+    + SinOscFB.ar(freq*34, fb, amp/34)
+    + SinOscFB.ar(freq*55, fb, amp/55)
+  ;
+  ss = [ss, DelayC.ar(ss, 0.005, 0.005)];
+  ss = ss * 0.7;
+  ss = BLowPass4.ar(ss, Rand(1060, 1260));
+  Out.ar(out, EnvGen.kr(shape, gate, doneAction: 2) * ss);
+}).add;
+
+// additive pulse synth
+SynthDef(\pope, {|out=0, gate=1, freq=440, release=1.8, amp=1, pan=0, doneAction=2|
+  var sig = 0;
+  var num = 30;
+  var panDelay = 0.005;
+  num.do({
+    sig = sig + (LFPulse.ar(freq, Rand(0, 0.01), SinOsc.kr(SinOsc.kr(Rand(2, 8), 0, 2, 2), Rand(0, 2pi), 0.5, 0.5)) / num);
+  });
+  sig = sig * EnvGen.kr(Env.asr(0.03, 0.3, release), gate, doneAction: doneAction);
+  sig = Pan2.ar(sig, pan, amp);
+  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);
+}).add;
+
+// bass drum 808 continuous
+SynthDef(\qoba, {|out=0, amp=1, pan=0, t_trig=0, accent=0.5, freq=50, tone=0.5, decay=0.5, attackfm=0.5, selffm=0.25|
+  var sig;
+  sig = AnalogBassDrum.ar(
+    t_trig,
+    infsustain: 0.0,
+    accent: accent,
+    freq: freq,
+    tone: tone,
+    decay: decay,
+    attackfm: attackfm,
+    selffm: selffm,
+  ) * amp;
+  // make click in the beginning almost absent
+  sig = sig * Line.ar(dur: 0.01);
+  sig = Pan2.ar(sig, pan);
+  Out.ar(out, sig);
+}).add;
+
+// bass drum single-use
+SynthDef(\ruse, { | gate = 1, freq = 55, amp=1, out=0 |
+  var sig = AnalogBassDrum.ar(
+    gate,
+    infsustain: 1,
+    accent: 0.9,
+    freq: freq,
+    tone: 0.6,
+    decay: 0.15,
+    attackfm: 0.31,
+    selffm: 0.15,
+  );
+  sig = sig * EnvGen.ar(Env.adsr(0.01, 0.2, 0.9, 0.25), gate, doneAction: 2);
+  sig = Pan2.ar(sig, 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;
index bcdaf5b..7552f31 100644 (file)
@@ -1,47 +1,7 @@
-// ==== Server setup
-//ServerOptions.outDevices
-
-s.options.outDevice = "Aggregate Device";
-
-//s.options.outDevice = "MA WFRIENDZ";
-//s.options.outDevice = "MacBook Air Speakers";
-//s.options.outDevice = "External Headphones";
-//s.options.outDevice = "EDIFIER R1080BT";
-//s.options.outDevice = "Scarlett 2i4 USB";
-//s.options.outDevice = "Bose Mini II SE SoundLink";
-
-s.options.inDevice = "Aggregate Device";
-
-//s.options.inDevice = "MacBook Air Microphone";
-//s.options.inDevice = "Scarlett 2i4 USB";
-//s.options.inDevice = "Scarlett Solo USB";
-
-// other server options
-s.options.maxNodes = 128 * 1024;
-s.options.maxSynthDefs = 32 * 1024;
-s.options.memSize = 1024 * 1024;
-s.options.numBuffers = 32 * 1024;
-s.options.numAudioBusChannels = 32 * 1024;
-s.options.numControlBusChannels = 256 * 1024;
-s.options.numInputBusChannels = 17;
-s.options.numOutputBusChannels = 20;
-s.options.numWireBufs = 128;
-s.options.hardwareBufferSize = 64;
-
-s.recHeaderFormat = "wav";
-s.latency = 0.4;
-
-Platform.case(
-  \osx, {
-    "Macos detected".postln;
-    thisProcess.platform.recordingsDir = "/Users/genio/stock/audio/supercollider";
-  },
-  \linux,     { "Linux detected".postln },
-  \windows,   { "Windows detected".postln }
-);
-
 // global nice variables
 
+~setup = ();
+
 a = (
   outs: 20,
   s: 16, // speakers output
@@ -55,64 +15,27 @@ c = (
   media: "~/gart/media"
 );
 
-// ==== Samplers setup
+// situation specific setup
+"./library/setup.scd".loadRelative;
 
-"./library/samplers.scd".loadRelative;
+// server setup
+"./library/serveroptions.scd".loadRelative;
 
-// ==== Midi setup
+// Samplers setup
+"./library/samplers.scd".loadRelative;
 
+// Midi setup
 "./library/midi.scd".loadRelative;
 
-// recording
-
-~recSpeakers = {s.record(bus: a.h)};
-
-/* 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;
+// superclean
+"./library/superclean.scd".loadRelative;
 
-// Other stuff
+// synths
+"./library/synths.scd".loadRelative;
 
-// A simple triangle wave synth in stereo with panning and a simple low pass filter
-// This synthDef was written by Mads Kjeldgaard and requires the sc3 plugins
-/*
-s.doWhenBooted{
-        SynthDef.new(\default, {
-                arg dur, attack=0.01, release=1.0,
-                t_gate=1, out, freq=442, cutoff=5500,
-                rq=1, pan=0.0, amp=0.5;
-                var env = EnvGen.kr(Env.perc(attack, release), t_gate, timeScale: dur, doneAction: 2);
-                var sig = DPW3Tri.ar(freq: freq, mul: env);
-                sig = RLPF.ar(sig, cutoff.clip(20.0, 20000.0), rq.clip(0.0,1.0));
-                sig = Pan2.ar(sig, pan);
-                Out.ar(out, sig * amp);
-        }).add;
-};
-*/
+// recording
 
-s.waitForBoot {
-  ~clean = SuperClean(2, s);
-  ~clean.loadSoundFiles; // hot swap in samples from anywhere!
-  //~clean.loadSoundFiles("~/gart/media/Хахомо");
-  s.sync; // optionally: wait for samples to be read
-  ~clean.start([18]); // first 8 out looks like [0,2,4,6]
-  SuperClean.default = ~clean;
-  "[ SuperClean up + running ]".postln;
-};
+~recSpeakers = {s.record(bus: a.h)};
 
 // ==== Scales
 
@@ -125,192 +48,3 @@ Tuning.all.put(\tritave13, Tuning.new((0..12).collect(_ * (12*(3 ** (1/13)).log2
 Scale.all.put(\tt13, Scale.chromatic(Tuning.at(\tritave13)));
 Scale.all.put(\hivi, Scale([0, 2, 4, 5, 7, 10, 12], 13, tuning: ~tun));
 
-// ==== Synths
-
-// == Sources
-
-// fm synth
-SynthDef(\bino, {|
-  out=0, gate=1, freq=440, modFreq=440, amp=1, release=1.0, maxIndex=1
-  |
-  var sig, modIndex, env;
-  env = EnvGen.ar(Env.asr(releaseTime: release), gate, doneAction: 2);
-  modIndex = (1 - env) * maxIndex;
-  sig = PMOsc.ar(freq, modFreq, modIndex, mul: amp);
-  sig = sig * env;
-  sig = Pan2.ar(sig, Rand(-0.3, 0.3));
-  Out.ar(out, sig * amp);
-}).add;
-
-// snare drum 808 continuous
-SynthDef(\buti, {|out=0, amp=1, pan=0, t_trig=0, accent=0.1, freq=200, tone=0.5, decay=0.5, snappy=0.5|
-  var sig;
-  sig = AnalogSnareDrum.ar(
-    t_trig,
-    infsustain: 0.0,
-    accent: accent,
-    freq: freq,
-    tone: tone,
-    decay: decay,
-    snappy: snappy,
-  ) * amp;
-  sig = Pan2.ar(sig, pan);
-  Out.ar(out, sig);
-}).add;
-
-// fm-synth pulse
-SynthDef(\dire, { |amp=1, out=0, freq=440, gate=1|
-  var sig, modFreq, env;
-  modFreq = SinOsc.ar(3000, mul: freq/4, add: freq);
-  sig = Pulse.ar(modFreq);
-  env = EnvGen.ar(Env.adsr(), gate, doneAction: 2);
-  sig = sig * env;
-  sig = Pan2.ar(sig, Rand(-0.5, 0.5));
-  Out.ar(out, sig * amp);
-}).add;
-
-// Subtract synth pad
-SynthDef(\dyti, {
-  | out=0, gate=1, freq=440, amp=1, pan=0, 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);
-}).add;
-
-// additive sin synth, sounds like metal
-SynthDef(\leto, { |freq = 440, sustain = 1, amp=1, out=0|
-  var sig = 0;
-  var num = 26;
-  var partial = 0;
-  num.do({
-    var pfact = ExpRand(1, 16);
-    partial = SinOsc.ar(freq * pfact, Rand(0, 2pi)) / num / pfact;
-    partial = partial * EnvGen.kr(Env.perc(0.03, Rand(sustain/5, sustain)));
-    partial = Pan2.ar(partial, Rand(-0.5, 0.5));
-    sig = sig + partial;
-  });
-  sig = sig * Line.kr(1, 1, sustain+0.1, doneAction: 2);
-  Out.ar(out, sig*amp);
-}).add;
-
-// round membrane drum continuous
-SynthDef(\liwe, {|out=0, amp=1, pan=0, t_trig=0, tension=0.05, loss=0.99999, impact=0.1|
-  var sig, excitation;
-  excitation = EnvGen.kr(Env.perc, t_trig, timeScale: impact, doneAction: 0);
-  excitation = excitation * PinkNoise.ar();
-  sig = MembraneCircle.ar(excitation, tension, loss, mul: amp);
-  sig = Pan2.ar(sig, pan);
-  Out.ar(out, sig);
-}).add;
-
-// Subtract synth drum
-SynthDef(\naje, {
-  | out=0, sustain=0.5, freq=440, amp=1, cut=800, rez=0.8,
-    modFreqMin=7, modFreqMax=12, modAmp=0.01 |
-  var sig = 0;
-  var modFreq = SinOsc.kr(Rand(modFreqMin, modFreqMax), 0, modAmp, 1);
-  sig = sig + Pulse.ar(freq * modFreq);
-  sig = RLPF.ar(sig, cut.lag(0.01), rez.lag(0.01));
-  sig = sig * EnvGen.ar(Env.perc(0.005, releaseTime: sustain), doneAction: 2);
-  sig = Pan2.ar(sig, Rand(-0.3, 0.3));
-  Out.ar(out, sig * amp);
-}).add;
-
-// fibonacci organ
-SynthDef.new(\neta, { arg freq = 440, amp = 1.0, gate = 1, out = 0;
-  var shape = Env.adsr(0.1, 0.2, 0.7, 0.5, 1.0, -4.0, 0);
-  var fb = 1.0;
-  var ss = SinOscFB.ar(freq, fb, amp)
-    + SinOscFB.ar(freq*2, fb, amp/2)
-    + SinOscFB.ar(freq*3, fb, amp/3)
-    + SinOscFB.ar(freq*5, fb, amp/5)
-    + SinOscFB.ar(freq*8, fb, amp/8)
-    + SinOscFB.ar(freq*13, fb, amp/13)
-    + SinOscFB.ar(freq*21, fb, amp/21)
-    + SinOscFB.ar(freq*34, fb, amp/34)
-    + SinOscFB.ar(freq*55, fb, amp/55)
-  ;
-  ss = [ss, DelayC.ar(ss, 0.005, 0.005)];
-  ss = ss * 0.7;
-  ss = BLowPass4.ar(ss, Rand(1060, 1260));
-  Out.ar(out, EnvGen.kr(shape, gate, doneAction: 2) * ss);
-}).add;
-
-// additive pulse synth
-SynthDef(\pope, {|out=0, gate=1, freq=440, release=1.8, amp=1, pan=0, doneAction=2|
-  var sig = 0;
-  var num = 30;
-  var panDelay = 0.005;
-  num.do({
-    sig = sig + (LFPulse.ar(freq, Rand(0, 0.01), SinOsc.kr(SinOsc.kr(Rand(2, 8), 0, 2, 2), Rand(0, 2pi), 0.5, 0.5)) / num);
-  });
-  sig = sig * EnvGen.kr(Env.asr(0.03, 0.3, release), gate, doneAction: doneAction);
-  sig = Pan2.ar(sig, pan, amp);
-  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);
-}).add;
-
-// bass drum 808 continuous
-SynthDef(\qoba, {|out=0, amp=1, pan=0, t_trig=0, accent=0.5, freq=50, tone=0.5, decay=0.5, attackfm=0.5, selffm=0.25|
-  var sig;
-  sig = AnalogBassDrum.ar(
-    t_trig,
-    infsustain: 0.0,
-    accent: accent,
-    freq: freq,
-    tone: tone,
-    decay: decay,
-    attackfm: attackfm,
-    selffm: selffm,
-  ) * amp;
-  // make click in the beginning almost absent
-  sig = sig * Line.ar(dur: 0.01);
-  sig = Pan2.ar(sig, pan);
-  Out.ar(out, sig);
-}).add;
-
-// bass drum single-use
-SynthDef(\ruse, { | gate = 1, freq = 55, amp=1, out=0 |
-  var sig = AnalogBassDrum.ar(
-    gate,
-    infsustain: 1,
-    accent: 0.9,
-    freq: freq,
-    tone: 0.6,
-    decay: 0.15,
-    attackfm: 0.31,
-    selffm: 0.15,
-  );
-  sig = sig * EnvGen.ar(Env.adsr(0.01, 0.2, 0.9, 0.25), gate, doneAction: 2);
-  sig = Pan2.ar(sig, 0);
-  Out.ar(out, sig * amp);
-}).add;
-
-// == Effects
-
-// 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;
index 4acce5c..b5a57bc 100644 (file)
--- a/temp.scd
+++ b/temp.scd
@@ -15,3 +15,22 @@ x.free;
 a = Pgeom(1, Pwhite(1, 5), 5);
 r = Routine { 2.yield; 3.yield; a.embedInStream; 7.yield; };
 r.nextN(12); // the next 12 values from r
+
+(
+Pdef(\temp, Pbind(*[
+  instrument: \defaultalt,
+  db: -9,
+  octave: Prand([4, 5, 6], inf)+[0, 2],
+  degree: Pseq([6, 5, 4, 6, 1, 3], inf),
+  dur: Pseq([3, 3, 2].split(1), inf),
+  release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*1.6,
+  legato: Pwhite(0.6, 0.7),
+  cut: Pexprand(400, 3200),
+  rez: Pwhite(0.6, 0.9),
+  modFreqMin: 4,
+  modFreqMax: 11,
+  modAmp: Pwhite(0.005, 0.01),
+  pan: Pwhite(-0.2, 0.2) * [-1, 1],
+  out: a.h,
+])).quant_(4).play;
+)
\ No newline at end of file