add interval generator
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Sat, 1 Apr 2023 17:19:19 +0000 (19:19 +0200)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Sat, 1 Apr 2023 17:19:19 +0000 (19:19 +0200)
Зю/interval-generator-Ҏэвёси/intervals.scd [new file with mode: 0644]

diff --git a/Зю/interval-generator-Ҏэвёси/intervals.scd b/Зю/interval-generator-Ҏэвёси/intervals.scd
new file mode 100644 (file)
index 0000000..7065cb6
--- /dev/null
@@ -0,0 +1,117 @@
+// generate and save to files intervals
+
+
+(
+s.latency = 0;
+s.recHeaderFormat = "flac";
+~dur = 1;
+~recDir = "~/intervals";
+~roots = (54, 61..80);
+~stepsSeq = (-12..12);
+~stepsPar = (0..12);
+
+~rec = Recorder.new(s);
+~rec.recHeaderFormat = "flac";
+~rec.recSampleFormat = "int24";
+
+~makeSeqSeq = {|midinote=60, steps=12|
+  Pbind(*[
+    instrument: \default,
+    midinote: Pseq([midinote, midinote+steps], 1),
+    dur: ~dur,
+    legato: 0.8,
+  ]);
+};
+
+~makeSeqPar = {|midinote=60, steps=12|
+  Pbind(*[
+    instrument: \default,
+    midinote: Pseq([[midinote, midinote+steps]], 1),
+    dur: ~dur,
+    legato: 0.8,
+  ]);
+};
+
+~gap = 0.2;
+TempoClock.tempo = 1;
+
+~intervalText = (
+  -1200: "1 / ",
+  -1100: "1 / ",
+  -1000: "1 / ",
+  -900: "1 / ",
+  -800: "1 / ",
+  -700: "1 / ",
+  -600: "1 / ",
+  -500: "1 / ",
+  -400: "1 / ",
+  -300: "1 / ",
+  -200: "1 / ",
+  -100: "1 / ",
+  0: "0 / 1:1",
+  100: "1 / ",
+  200: "1 / ",
+  300: "1 / ",
+  400: "1 / ",
+  500: "1 / ",
+  600: "1 / ",
+  700: "1 / ",
+  800: "1 / ",
+  900: "1 / ",
+  1000: "1 / ",
+  1100: "1 / ",
+  1200: "1 / ",
+);
+)
+
+(
+{
+  var f;
+  f = File((~recDir++"/intervals.txt").standardizePath, "w");
+  // test      [sound:par-61-0.flac]   унисон    вместе
+  ~roots.do{|note|
+    ~stepsSeq.do{|step|
+      var filename = "seq-"++note++"-"++(step*100).round(1)++".flac";
+      var seq = ~makeSeqSeq.value(note, step);
+      f.write("%-%-%,[sound:%],%,%\n".format(
+        note, (step*100).round(1), "seq",
+        filename,
+        step,
+        "последовательно"
+      ));
+      ~rec.record(
+        path: ~recDir++"/"++filename,
+        duration: 2 * ~dur / TempoClock.tempo + (2*~gap)
+      );
+      ~gap.wait;
+      seq.play();
+      (2*~dur).wait;
+      ~gap.wait;
+      ~gap.wait;
+    };
+    ~stepsPar.do{|step|
+      var filename = "par-"++note++"-"++(step*100).round(1)++".flac";
+      var seq = ~makeSeqPar.value(note, step);
+      f.write("%-%-%,[sound:%],%,%\n".format(
+        note, (step*100).round(1), "par",
+        filename,
+        step,
+        "вместе"
+      ));
+      ~rec.record(
+        path: ~recDir++"/"++filename,
+        duration: ~dur / TempoClock.tempo + (2*~gap)
+      );
+      ~gap.wait;
+      seq.play();
+      (~dur).wait;
+      ~gap.wait;
+      ~gap.wait;
+    };
+  };
+  f.close;
+}.fork();
+)
+
+
+