add gui for beat machine
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 4 Apr 2023 21:45:34 +0000 (23:45 +0200)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Tue, 4 Apr 2023 21:45:34 +0000 (23:45 +0200)
Зя/Зясыл-Мийису/Мийису.scd

index 6a65b0a..cbd80de 100644 (file)
@@ -4,6 +4,10 @@
 
 // preparations
 
+(
+~midimix = MidiMix101();
+)
+
 (
 ~beatGen = {|
   depth=1,
   ],
   s, \addToTail
 );
+)
 
-~reverbSynths.do{|item|
-  item.set(\mix, 0.4.rand);
-};
+(
+TempoClock.tempo = 1/8;
 )
 
+// gui
+
 (
-TempoClock.tempo = 1/4;
-~bass = ~makeTrack.(\bass, b.bass, 5, 1, -3);
-~snare = ~makeTrack.(\snare, b.snare, 6, 1, -7);
+~bassSeed = 1000;
+~snareSeed = 2000;
+~chhSeed = 3000;
+~clapSeed = 4000;
+)
+
+(
+Window.closeAll;
+
+~bw = Window("Beat machine", Rect(0, 0, 800, 600))
+.alwaysOnTop_(true).front;
+
+NumberBox(~bw, Rect(0, 0, 100, 20))
+.value_(~bassSeed)
+.action_{|v|
+  thisThread.randSeed = ~bassSeed = v.value;
+  ~bass = ~makeTrack.(\bass, b.bass, 5, 1, -3);
+  Pdef(\bass, ~bass).quant_(1).play;
+};
+StaticText(~bw, Rect(100, 0, 100, 20)).string_("bass");
+
+NumberBox(~bw, Rect(0, 20, 100, 20))
+.value_(~snareSeed)
+.action_{|v|
+  thisThread.randSeed = ~snareSeed = v.value;
+  ~snare = ~makeTrack.(\snare, b.snare, 6, 1, -7);
+  Pdef(\snare, ~snare).quant_(1).play;
+};
+StaticText(~bw, Rect(100, 20, 100, 20)).string_("snare");
+
+NumberBox(~bw, Rect(0, 40, 100, 20))
+.value_(~chhSeed)
+.action_{|v|
+  thisThread.randSeed = ~chhSeed = v.value;
 ~chh = ~makeTrack.(\chh, b.hatclosed, 7, 1, -8);
-~clap = ~makeTrack.(\clap, b.clap, 7, 1, -15);
-Pdef(\bass, ~bass).quant_(1).play;
-Pdef(\snare, ~snare).quant_(1).play;
 Pdef(\chh, ~chh).quant_(1).play;
+};
+StaticText(~bw, Rect(100, 40, 100, 20)).string_("closed hhat");
+
+NumberBox(~bw, Rect(0, 60, 100, 20))
+.value_(~clapSeed)
+.action_{|v|
+  thisThread.randSeed = ~clapSeed = v.value;
+~clap = ~makeTrack.(\clap, b.clap, 7, 1, -15);
 Pdef(\clap, ~clap).quant_(1).play;
+};
+StaticText(~bw, Rect(100, 60, 100, 20)).string_("clap");
 )
 
+Pdef(\snare).stop;
+Pdef(\bass).stop;
+Pdef(\clap).stop;
+Pdef(\chh).stop;
+Pdef.all.do{|i| i.stop};
\ No newline at end of file