Add divisor and save nice beat
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 21 Mar 2023 01:29:39 +0000 (02:29 +0100)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 21 Mar 2023 01:29:39 +0000 (02:29 +0100)
Зясах-Мыҏиӈё.scd

index 9eae77f..f75e320 100644 (file)
@@ -239,20 +239,24 @@ Pdef(\test, ~nyhoweni).quant_(1).play;
 (
 TempoClock.tempo = 1/4;
 
-~beatGenerator = {|depth=1, attack=0.07, release=0.7,  chance=0.6|
-  var beat = [[1, 0, 0, attack, release]];
+~beatGenerator = {|depth=1, dur=1, degree=0, db=0, attack=0.07, release=0.7,  chance=0.6, weights=#[10, 1]|
+  var beat = [[dur, degree, db, attack, release]];
+  weights = weights.normalizeSum;
   (depth-1).do{|i|
     var newBeat = [];
     beat.do{|hit, j|
       chance.coin.if {
+        var divider = Array.series(weights.size, 2).wchoose(weights);
         var newHit = [
-          hit[0] / 2,
+          hit[0] / divider,
           hit[1] + 1,
-          -3 * i,
+          db - (3 * i),
           attack / (i+1),
           release / (i+1),
         ];
-        newBeat = newBeat.add(newHit).add(newHit);
+        divider.do{
+          newBeat = newBeat.add(newHit)
+        };
       } {newBeat = newBeat.add(hit)};
     };
     beat = newBeat;
@@ -260,11 +264,11 @@ TempoClock.tempo = 1/4;
   beat;
 };
 
-~beatQogamocy = ~beatGenerator.(7);
+~beatQogamocy = ~beatGenerator.(5);
 ~qogamocy = Pbind(*[
   out: Pshuf(~reverbBusses.wrapExtend(~beatQogamocy.size), inf),
   instrument: Pshuf(~synthNames.wrapExtend(~beatQogamocy.size), inf),
-  pan: [-1, 1],
+  pan: [-0.2, 0.2],
   scale: Pn(~scale),
   octave: 2,
   #[\dur, \degree, \db, \attack, \release]: Pseq(
@@ -272,13 +276,13 @@ TempoClock.tempo = 1/4;
   ),
   timingOffset: 0,
 ]);
-Pdef(\qogamocy, ~qogamocy).quant_(1).stop;
+Pdef(\qogamocy, ~qogamocy).quant_(1).play;
 
-~beatJocenyne = ~beatGenerator.(7);
+~beatJocenyne = ~beatGenerator.(6);
 ~jocenyne = Pbind(*[
   out: Pshuf(~reverbBusses.wrapExtend(~beatJocenyne.size), inf),
   instrument: Pshuf(~synthNames.wrapExtend(~beatJocenyne.size), inf),
-  pan: [-1, 1],
+  pan: [-0.4, -0.4],
   scale: Pn(~scale),
   octave: 3,
   #[\dur, \degree, \db, \attack, \release]: Pseq(
@@ -286,13 +290,13 @@ Pdef(\qogamocy, ~qogamocy).quant_(1).stop;
   ),
   timingOffset: 0,
 ]);
-Pdef(\jocenyne, ~jocenyne).quant_(1).stop;
+Pdef(\jocenyne, ~jocenyne).quant_(1).play;
 
-~beatCocewary = ~beatGenerator.(7);
+~beatCocewary = ~beatGenerator.(7, db: -3);
 ~cocewary = Pbind(*[
   out: Pshuf(~reverbBusses.wrapExtend(~beatCocewary.size), inf),
   instrument: Pshuf(~synthNames.wrapExtend(~beatCocewary.size), inf),
-  pan: [-1, 1],
+  pan: [-0.6, 0.6],
   scale: Pn(~scale),
   octave: 4,
   #[\dur, \degree, \db, \attack, \release]: Pseq(
@@ -300,13 +304,13 @@ Pdef(\jocenyne, ~jocenyne).quant_(1).stop;
   ),
   timingOffset: 0,
 ]);
-Pdef(\cocewary, ~cocewary).quant_(1).stop;
+Pdef(\cocewary, ~cocewary).quant_(1).play;
 
-~beatSicilaqe = ~beatGenerator.(7, chance: 0.5);
+~beatSicilaqe = ~beatGenerator.(7, 2, db: -6, chance: 0.5);
 ~sicilaqe = Pbind(*[
   out: Pshuf(~reverbBusses.wrapExtend(~beatSicilaqe.size), inf),
   instrument: Pshuf(~synthNames.wrapExtend(~beatSicilaqe.size), inf),
-  pan: [-1, 1],
+  pan: [-0.8, 0.8],
   scale: Pn(~scale),
   octave: 5,
   #[\dur, \degree, \db, \attack, \release]: Pseq(
@@ -314,7 +318,43 @@ Pdef(\cocewary, ~cocewary).quant_(1).stop;
   ),
   timingOffset: 0,
 ]);
-Pdef(\sicilaqe, ~sicilaqe).quant_(1).stop;
+Pdef(\sicilaqe, ~sicilaqe).quant_(2).play;
+
+~beatGytuzowi = ~beatGenerator.(7, 2, db: -12, chance: 0.5);
+~gytuzowi = Pbind(*[
+  out: Pshuf(~reverbBusses.wrapExtend(~beatGytuzowi.size), inf),
+  instrument: Pshuf(~synthNames.wrapExtend(~beatGytuzowi.size), inf),
+  pan: [-0.9, 0.9],
+  scale: Pn(~scale),
+  octave: 6,
+  #[\dur, \degree, \db, \attack, \release]: Pseq(
+    ~beatGytuzowi, inf,
+  ),
+  timingOffset: 0,
+]);
+Pdef(\gytuzowi, ~gytuzowi).quant_(2).play;
+/* very nice beat hediwana.beats:
+
+~beatQogamocy = [ [ 0.125, 3, -9, 0.0175, 0.175 ], [ 0.125, 3, -9, 0.0175, 0.175 ], [ 0.25, 2, -6, 0.023333333333333, 0.23333333333333 ], [ 0.125, 3, -9, 0.0175, 0.175 ], [ 0.125, 3, -9, 0.0175, 0.175 ], [ 0.25, 2, -3, 0.035, 0.35 ] ];
+
+~beatJocenyne = [ [ 0.0625, 4, -12, 0.014, 0.14 ], [ 0.0625, 4, -12, 0.014, 0.14 ], [ 0.0625, 4, -9, 0.0175, 0.175 ], [ 0.0625, 4, -9, 0.0175, 0.175 ], [ 0.0625, 4, -9, 0.0175, 0.175 ], [ 0.03125, 5, -12, 0.014, 0.14 ], [ 0.03125, 5, -12, 0.014, 0.14 ], [ 0.0625, 4, -12, 0.014, 0.14 ], [ 0.0625, 4, -12, 0.014, 0.14 ], [ 0.083333333333333, 3, -9, 0.0175, 0.175 ], [ 0.041666666666667, 4, -12, 0.014, 0.14 ], [ 0.041666666666667, 4, -12, 0.014, 0.14 ], [ 0.041666666666667, 4, -12, 0.014, 0.14 ], [ 0.041666666666667, 4, -12, 0.014, 0.14 ], [ 0.125, 3, -9, 0.0175, 0.175 ], [ 0.125, 3, -9, 0.0175, 0.175 ] ];
+
+~beatCocewary = [ [ 0.0625, 4, -15, 0.014, 0.14 ], [ 0.03125, 5, -18, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 5, -18, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 5, -18, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 5, -18, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 5, -18, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 5, -18, 0.011666666666667, 0.11666666666667 ], [ 0.0625, 4, -15, 0.014, 0.14 ], [ 0.0625, 4, -15, 0.014, 0.14 ], [ 0.125, 3, -12, 0.0175, 0.175 ], [ 0.083333333333333, 3, -15, 0.014, 0.14 ], [ 0.041666666666667, 4, -18, 0.011666666666667, 0.11666666666667 ], [ 0.041666666666667, 4, -18, 0.011666666666667, 0.11666666666667 ], [ 0.083333333333333, 3, -15, 0.014, 0.14 ], [ 0.125, 3, -18, 0.011666666666667, 0.11666666666667 ], [ 0.125, 3, -18, 0.011666666666667, 0.11666666666667 ] ];
+
+~beatSicilaqe = [ [ 0.5, 2, -18, 0.014, 0.14 ], [ 0.25, 3, -21, 0.011666666666667, 0.11666666666667 ], [ 0.25, 3, -21, 0.011666666666667, 0.11666666666667 ], [ 0.125, 4, -21, 0.011666666666667, 0.11666666666667 ], [ 0.125, 4, -21, 0.011666666666667, 0.11666666666667 ], [ 0.25, 3, -18, 0.014, 0.14 ], [ 0.5, 2, -15, 0.0175, 0.175 ] ];
+
+~beatGytuzowi = [ [ 0.125, 4, -21, 0.0175, 0.175 ], [ 0.0625, 5, -24, 0.014, 0.14 ], [ 0.0625, 5, -24, 0.014, 0.14 ], [ 0.0625, 5, -24, 0.014, 0.14 ], [ 0.0625, 5, -24, 0.014, 0.14 ], [ 0.03125, 6, -27, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 6, -27, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 6, -27, 0.011666666666667, 0.11666666666667 ], [ 0.03125, 6, -27, 0.011666666666667, 0.11666666666667 ], [ 0.083333333333333, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.083333333333333, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.083333333333333, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.125, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.125, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.5, 2, -18, 0.023333333333333, 0.23333333333333 ], [ 0.125, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.125, 4, -27, 0.011666666666667, 0.11666666666667 ], [ 0.25, 3, -24, 0.014, 0.14 ] ];
+*/
+)
+
+(
+[
+  ~beatQogamocy,
+  ~beatJocenyne,
+  ~beatCocewary,
+  ~beatSicilaqe,
+  ~beatGytuzowi,
+].writeArchive(Document.current.dir +/+ "hediwana.beats");
 )
 
 Pdef.all.do{|i| i.stop};