live coding session / improve synths
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 2 Jan 2024 18:03:28 +0000 (19:03 +0100)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 2 Jan 2024 18:03:28 +0000 (19:03 +0100)
startup.scd
temp.scd
Ка/Камыр-Хыпёдё/Хыпёдё-песня.scd

index 76d6880..2282fd4 100644 (file)
@@ -317,14 +317,14 @@ SynthDef.new(\neta, { arg freq = 440, amp = 1.0, gate = 1, out = 0;
 }).add;
 
 // additive pulse synth
-SynthDef(\pope, {|out=0, gate=1, freq=440, amp=1, pan=0, doneAction=2|
+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, 1.8), gate, doneAction: doneAction);
+  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);
index 89d633b..5df2882 100644 (file)
--- a/temp.scd
+++ b/temp.scd
@@ -7,4 +7,11 @@ SynthDef(\guitar, {|in, out, amp=1.0|
 )
 
 x = Synth.new(\guitar, [\in, a.outs+1, \out, 0]);
-x.free;
\ No newline at end of file
+x.free;
+
+~s = Pseq([Pshuf([1, 2, 3], 1)], 3).asStream;
+10.do{~s.next.postln};
+
+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
\ No newline at end of file
index 885e1d4..1cd54b5 100644 (file)
 // Хыпёдё
 
-// instrument
+// values
 
+(
+~numReverbs = 5;
+)
+
+// instruments
+
+(
+// amplification coefficients for samples
+~hahomo = (
+  name: "Хахомо",
+  params: [(
+    name: \bu,
+    mul: 0.5,
+  ), (
+    name: \me,
+    mul: 10,
+  ), (
+    name: \mo,
+    mul: 6,
+  ), (
+    name: \nu,
+    mul: 3,
+  ), (
+    name: \da,
+    mul: 3,
+  ), (
+    name: \do,
+    mul: 2,
+  ), (
+    name: \tu,
+    mul: 5,
+  ), (
+    name: \by,
+    mul: 1,
+  ), (
+    name: \bo,
+    mul: 1.5,
+  ), (
+    name: \be,
+    mul: 1.5,
+  ), (
+    name: \ma,
+    mul: 1,
+  ), (
+    name: \my,
+    mul: 1,
+  )];
+);
+)
+
+(
 ~hahomoInstruments = ~makeSampleSynths.(
   ~hahomo.name,
   ~hahomo.params
 );
+)
+
+// effects
+
+(
+~createGroupsBusses = {
+  ~instrumentGroup = Group(s);
+  ~effectGroup = Group.after(~instrumentGroup);
+  ~mixerGroup = Group.after(~effectGroup);
+
+  ~mainBus = Bus.audio(s, 2);
+  ~mainMixer = Synth(\fader, (
+    in: ~mainBus,
+    out: a.h,
+    amp: 1.0,
+  ).asPairs, ~mixerGroup);
+
+  ~jpverbs = Array();
+  ~reverbBuses = Array();
+  ~numReverbs.do{
+    ~reverbBuses = ~reverbBuses.add(Bus.audio(s, 2));
+    ~jpverbs = ~jpverbs.add(Synth(\qahe, (
+      mix: 0.1.rrand(0.8),
+      t60: 1.0.rrand(10.0),
+      damp: 0.0.rrand(1.0),
+      size: 1.0.rrand(4.0),
+      earlyDiff: 0.5.rrand(0.9),
+      modDepth: 0.0.rrand(0.05),
+      modFreq: 2.0.rrand(15.0),
+      low: 0.7.rrand(1.0),
+      mid: 0.7.rrand(1.0),
+      high: 0.7.rrand(1.0),
+      lowcut: 500.0,
+      highcut: 2000.0,
+      in: ~reverbBuses.last,
+      out: ~mainBus,
+    ).asPairs, ~effectGroup));
+  };
+};
+ServerTree.add(~createGroupsBusses);
+ServerTree.add{s.plotTree};
+)
 
 // test
 
 Pdef(\buben, Pbind(*[
   instrument: Prand([\bu, \bo, \be, \by], inf),
   db: -6,
-  dur: Pn(Pseq(2.split(3)++2.split(4), 4), inf),
+  dur: Pn(Pseq(2.split(3)++2.split(4), 4), 1),
   pan: Pwhite(-0.4, 0.4),
-  out: a.h,
-])).quant_(4).stop;
+  out: ~reverbBuses[1],
+])).quant_(4).play;
 )
 
 (
@@ -25,17 +118,17 @@ Pdef(\plate, Pbind(*[
   db: -12,
   dur: Pn(Pseq(2.split(4)++2.split(5), 4), 1),
   pan: Pwhite(-0.7, 0.7),
-  out: a.h,
+  out: Prand(~reverbBuses, inf),
 ])).quant_(4).play;
 )
 
 (
 Pdef(\bass, Pbind(*[
   instrument: Prand([\da, \da], inf),
-  db: -12,
+  db: -18,
   dur: Pn(Pseq(2.split(2)++2.split(3), 4), 1),
   pan: Pwhite(-0.5, 0.5),
-  out: a.h,
+  out: Prand(~reverbBuses, inf),
 ])).quant_(4).play;
 )
 
@@ -45,49 +138,82 @@ Pdef(\extra, Pbind(*[
   db: -15,
   dur: Pn(Pseq(4.split(5), 4), 1),
   pan: Pwhite(-0.5, 0.5),
-  out: a.h,
+  out: Prand(~reverbBuses, inf),
 ])).quant_(4).play;
 )
 
 (
 Pdef(\melody, Pbind(*[
   instrument: \dyti,
-  db: -17,
+  db: -23,
   octave: Prand([4, 5, 6], inf)+[0, 2],
-  degree: Pseq([0, 2, 4, 2, 1, 5], inf),
-  dur: Pseq([3, 3, 2].split(4)/2, 1),
-  release: TempoClock.tempo.reciprocal*2,
-  legato: 0.2,
-  cut: Pexprand(400, 800),
+  degree: Pseq([6, 5, 4, 6, 1, 3], inf),
+  dur: Pseq([3, 3, 2].split(4), 1),
+  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,
+  out: ~reverbBuses[0],
+])).quant_(4).play;
+)
+
+(
+Pdef(\melodytwo, Pbind(*[
+  instrument: \pope,
+  db: -16,
+  octave: Prand([5, 6, 7], inf)+[0, 1],
+  degree: Pseq([6, 4, 3, 6, 2, 5], inf),
+  dur: Pseq([3, 3, 2].split(4), 1),
+  release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*1.5,
+  legato: Pwhite(0.2, 0.4),
+  pan: Pwhite(-0.4, 0.4) * [-1, 1],
+  out: ~reverbBuses[2],
+])).quant_(4).play;
+)
+
+(
+Pdef(\melodythree, Pbind(*[
+  instrument: \bino,
+  db: -23,
+  octave: Prand([3, 4, 5], inf),
+  degree: Pseq((0..7), inf),
+  dur: Pseq([3, 3, 2]/8, 1),
+  release: Pwhite(0.5, 1.2)*TempoClock.tempo.reciprocal*1.5,
+  legato: Pwhite(0.5, 0.8),
+  modFreq: 220,
+  maxIndex: 4,
+  pan: Pwhite(-0.4, 0.4),
+  out: ~reverbBuses[3],
 ])).quant_(4).play;
 )
 
 (
 Pdef(\pad, Pbind(*[
   instrument: \neta,
-  db: -17,
-  octave: 3,
+  db: -22,
+  octave: 2,
   degree: Pseq([0, 2, 4, 2, 1, 5], inf),
   dur: Pseq([3, 3, 2].split(2)/2, 1),
   legato: 0.8,
   pan: Pwhite(-0.2, 0.2) * [-1, 1],
-  out: a.h,
+  out: ~reverbBuses[0],
 ])).quant_(4).play;
 )
 
 (
 Pdef(\metal, Pbind(*[
   instrument: \leto,
-  db: -11,
-  octave: Prand([6, 7, 8, 9], inf),
-  degree: Pseq([0, 2, 4, 2, 1, 5], inf),
+  db: -15,
+  octave: Prand([8, 9], inf),
+  degree: Pxrand([0, 2, 4, 2, 1, 5], inf),
   dur: Pseq([3, 3, 2].split(3)/2, 1),
   legato: Pwhite(0.8, 1.2),
   pan: Pwhite(-0.7, 0.7) * [-1, 1],
-  out: a.h,
+  out: ~reverbBuses[0],
 ])).quant_(4).play;
 )
 
@@ -101,8 +227,8 @@ Pdef(\baseight, Pmono(\qoba, *[
   attackfm: 0.3,
   selffm: 0.75,
   dur: Pseq(1.split(1)++1.split(2)++2.split(3), 1),
-  db: Pwhite(5, 8),
-  out: a.h,
+  db: Pwhite(5, 8)-3,
+  out: ~mainBus,
 ])).quant_(4).play;
 )
 
@@ -113,10 +239,96 @@ Pdef(\memb, Pmono(\liwe, *[
   loss: Pexprand(0.9999, 0.99999),
   impact: 0.1,
   dur: Pseq(1.split(1)++1.split(2)++2.split(3), 1),
-  db: -9,
-  out: a.h,
+  db: -24,
+  out: ~mainBus,
 ])).quant_(4).play;
 )
 
-s.record(bus: a.h);
+(
+Pdef(\marimba0, Pbind(*[
+  instrument: Prand(~synthNames, inf),
+  octave: Prand([3], inf),
+  degree: Pxrand([0, 2, 4, 6, 1, 5], inf),
+  attack: TempoClock.tempo.reciprocal*0.01,
+  release: TempoClock.tempo.reciprocal*1.0,
+  dur: Pseq(4.split(4), 1),
+  pan: Pwhite(-0.5, 0.5),
+  out: Prand(~reverbBuses, inf),
+  db: -8,
+])).quant_(4).play;
+
+Pdef(\marimba1, Pbind(*[
+  instrument: Prand(~synthNames, inf),
+  octave: Prand([4], inf),
+  degree: Pxrand([0, 2, 4, 2, 6, 5], inf),
+  attack: TempoClock.tempo.reciprocal*0.01,
+  release: TempoClock.tempo.reciprocal*1.0,
+  dur: Pseq(4.split(5), 1),
+  pan: Pwhite(-0.5, 0.5),
+  out: Prand(~reverbBuses, inf),
+  db: -10,
+])).quant_(4).play;
+
+Pdef(\marimba2, Pbind(*[
+  instrument: Prand(~synthNames, inf),
+  octave: Prand([5], inf),
+  degree: Pxrand([6, 2, 4, 2, 1, 6], inf),
+  attack: TempoClock.tempo.reciprocal*0.01,
+  release: TempoClock.tempo.reciprocal*1.0,
+  dur: Pseq(4.split(5), 1),
+  pan: Pwhite(-0.5, 0.5),
+  out: Prand(~reverbBuses, inf),
+  db: -13,
+])).quant_(4).play;
+
+Pdef(\marimba3, Pbind(*[
+  instrument: Prand(~synthNames, inf),
+  octave: Prand([6], inf),
+  degree: Pxrand([1, 2, 6, 6, 1, 6], inf),
+  attack: TempoClock.tempo.reciprocal*0.01,
+  release: TempoClock.tempo.reciprocal*1.0,
+  dur: Pseq(4.split(6), 1),
+  pan: Pwhite(-0.5, 0.5),
+  out: Prand(~reverbBuses, inf),
+  db: -16,
+])).quant_(4).play;
+
+Pdef(\marimba4, Pbind(*[
+  instrument: Prand(~synthNames, inf),
+  octave: Prand([7], inf),
+  degree: Pxrand([6, 2, 4, 6, 5, 6], inf),
+  attack: TempoClock.tempo.reciprocal*0.01,
+  release: TempoClock.tempo.reciprocal*1.0,
+  dur: Pseq(4.split(6), 1),
+  pan: Pwhite(-0.5, 0.5),
+  out: Prand(~reverbBuses, inf),
+  db: -19,
+])).quant_(4).play;
+)
+
+(
+Pdef(\marimba0).play;
+Pdef(\marimba1).play;
+Pdef(\marimba2).play;
+Pdef(\marimba3).play;
+Pdef(\marimba4).play;
+)
+
+(
+Pdef(\marimba0).stop;
+Pdef(\marimba1).stop;
+Pdef(\marimba2).stop;
+Pdef(\marimba3).stop;
+Pdef(\marimba4).stop;
+)
+
+// mixer TODO: create another file for mixer
+
+~mainMixer.set(\amp, -6.dbamp);
+
+// recording
+
+(
+s.record(bus: ~mainBus);
+)
 s.stopRecording;
\ No newline at end of file