; RYCHTA ; ; drum sequencer made out of necessity ; ; use with WaggonBAU or Sitala ; ; (s) Severák 2019 ; licensed with MIT license bounds(0, 0, 0, 0) form caption("Rychta") size(700, 370), colour(58, 110, 182), pluginid("rych") ; UI was generated using profi method called copy&paste texteditor bounds(6, 10, 100, 30) channel("r1name") checkbox bounds(114, 10, 30, 30) channel("r1c1") checkbox bounds(148, 10, 30, 30) channel("r1c2") checkbox bounds(182, 10, 30, 30) channel("r1c3") checkbox bounds(216, 10, 30, 30) channel("r1c4") checkbox bounds(250, 10, 30, 30) channel("r1c5") checkbox bounds(284, 10, 30, 30) channel("r1c6") checkbox bounds(318, 10, 30, 30) channel("r1c7") checkbox bounds(352, 10, 30, 30) channel("r1c8") checkbox bounds(386, 10, 30, 30) channel("r1c9") checkbox bounds(420, 10, 30, 30) channel("r1c10") checkbox bounds(454, 10, 30, 30) channel("r1c11") checkbox bounds(488, 10, 30, 30) channel("r1c12") checkbox bounds(522, 10, 30, 30) channel("r1c13") checkbox bounds(556, 10, 30, 30) channel("r1c14") checkbox bounds(590, 10, 30, 30) channel("r1c15") checkbox bounds(624, 10, 30, 30) channel("r1c16") nslider bounds(658, 10, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r1note") ;--- texteditor bounds(6, 44, 100, 30) channel("r2name") checkbox bounds(114, 44, 30, 30) channel("r2c1") checkbox bounds(148, 44, 30, 30) channel("r2c2") checkbox bounds(182, 44, 30, 30) channel("r2c3") checkbox bounds(216, 44, 30, 30) channel("r2c4") checkbox bounds(250, 44, 30, 30) channel("r2c5") checkbox bounds(284, 44, 30, 30) channel("r2c6") checkbox bounds(318, 44, 30, 30) channel("r2c7") checkbox bounds(352, 44, 30, 30) channel("r2c8") checkbox bounds(386, 44, 30, 30) channel("r2c9") checkbox bounds(420, 44, 30, 30) channel("r2c10") checkbox bounds(454, 44, 30, 30) channel("r2c11") checkbox bounds(488, 44, 30, 30) channel("r2c12") checkbox bounds(522, 44, 30, 30) channel("r2c13") checkbox bounds(556, 44, 30, 30) channel("r2c14") checkbox bounds(590, 44, 30, 30) channel("r2c15") checkbox bounds(624, 44, 30, 30) channel("r2c16") nslider bounds(658, 44, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r2note") ;--- texteditor bounds(6, 78, 100, 30) channel("r3name") checkbox bounds(114, 78, 30, 30) channel("r3c1") checkbox bounds(148, 78, 30, 30) channel("r3c2") checkbox bounds(182, 78, 30, 30) channel("r3c3") checkbox bounds(216, 78, 30, 30) channel("r3c4") checkbox bounds(250, 78, 30, 30) channel("r3c5") checkbox bounds(284, 78, 30, 30) channel("r3c6") checkbox bounds(318, 78, 30, 30) channel("r3c7") checkbox bounds(352, 78, 30, 30) channel("r3c8") checkbox bounds(386, 78, 30, 30) channel("r3c9") checkbox bounds(420, 78, 30, 30) channel("r3c10") checkbox bounds(454, 78, 30, 30) channel("r3c11") checkbox bounds(488, 78, 30, 30) channel("r3c12") checkbox bounds(522, 78, 30, 30) channel("r3c13") checkbox bounds(556, 78, 30, 30) channel("r3c14") checkbox bounds(590, 78, 30, 30) channel("r3c15") checkbox bounds(624, 78, 30, 30) channel("r3c16") nslider bounds(658, 78, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r3note") ;--- texteditor bounds(6, 112, 100, 30) channel("r4name") checkbox bounds(114, 112, 30, 30) channel("r4c1") checkbox bounds(148, 112, 30, 30) channel("r4c2") checkbox bounds(182, 112, 30, 30) channel("r4c3") checkbox bounds(216, 112, 30, 30) channel("r4c4") checkbox bounds(250, 112, 30, 30) channel("r4c5") checkbox bounds(284, 112, 30, 30) channel("r4c6") checkbox bounds(318, 112, 30, 30) channel("r4c7") checkbox bounds(352, 112, 30, 30) channel("r4c8") checkbox bounds(386, 112, 30, 30) channel("r4c9") checkbox bounds(420, 112, 30, 30) channel("r4c10") checkbox bounds(454, 112, 30, 30) channel("r4c11") checkbox bounds(488, 112, 30, 30) channel("r4c12") checkbox bounds(522, 112, 30, 30) channel("r4c13") checkbox bounds(556, 112, 30, 30) channel("r4c14") checkbox bounds(590, 112, 30, 30) channel("r4c15") checkbox bounds(624, 112, 30, 30) channel("r4c16") nslider bounds(658, 112, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r4note") ;--- texteditor bounds(6, 146, 100, 30) channel("r5name") checkbox bounds(114, 146, 30, 30) channel("r5c1") checkbox bounds(148, 146, 30, 30) channel("r5c2") checkbox bounds(182, 146, 30, 30) channel("r5c3") checkbox bounds(216, 146, 30, 30) channel("r5c4") checkbox bounds(250, 146, 30, 30) channel("r5c5") checkbox bounds(284, 146, 30, 30) channel("r5c6") checkbox bounds(318, 146, 30, 30) channel("r5c7") checkbox bounds(352, 146, 30, 30) channel("r5c8") checkbox bounds(386, 146, 30, 30) channel("r5c9") checkbox bounds(420, 146, 30, 30) channel("r5c10") checkbox bounds(454, 146, 30, 30) channel("r5c11") checkbox bounds(488, 146, 30, 30) channel("r5c12") checkbox bounds(522, 146, 30, 30) channel("r5c13") checkbox bounds(556, 146, 30, 30) channel("r5c14") checkbox bounds(590, 146, 30, 30) channel("r5c15") checkbox bounds(624, 146, 30, 30) channel("r5c16") nslider bounds(658, 146, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r5note") ;--- texteditor bounds(6, 180, 100, 30) channel("r6name") checkbox bounds(114, 180, 30, 30) channel("r6c1") checkbox bounds(148, 180, 30, 30) channel("r6c2") checkbox bounds(182, 180, 30, 30) channel("r6c3") checkbox bounds(216, 180, 30, 30) channel("r6c4") checkbox bounds(250, 180, 30, 30) channel("r6c5") checkbox bounds(284, 180, 30, 30) channel("r6c6") checkbox bounds(318, 180, 30, 30) channel("r6c7") checkbox bounds(352, 180, 30, 30) channel("r6c8") checkbox bounds(386, 180, 30, 30) channel("r6c9") checkbox bounds(420, 180, 30, 30) channel("r6c10") checkbox bounds(454, 180, 30, 30) channel("r6c11") checkbox bounds(488, 180, 30, 30) channel("r6c12") checkbox bounds(522, 180, 30, 30) channel("r6c13") checkbox bounds(556, 180, 30, 30) channel("r6c14") checkbox bounds(590, 180, 30, 30) channel("r6c15") checkbox bounds(624, 180, 30, 30) channel("r6c16") nslider bounds(658, 180, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r6note") ;--- texteditor bounds(6, 214, 100, 30) channel("r7name") checkbox bounds(114, 214, 30, 30) channel("r7c1") checkbox bounds(148, 214, 30, 30) channel("r7c2") checkbox bounds(182, 214, 30, 30) channel("r7c3") checkbox bounds(216, 214, 30, 30) channel("r7c4") checkbox bounds(250, 214, 30, 30) channel("r7c5") checkbox bounds(284, 214, 30, 30) channel("r7c6") checkbox bounds(318, 214, 30, 30) channel("r7c7") checkbox bounds(352, 214, 30, 30) channel("r7c8") checkbox bounds(386, 214, 30, 30) channel("r7c9") checkbox bounds(420, 214, 30, 30) channel("r7c10") checkbox bounds(454, 214, 30, 30) channel("r7c11") checkbox bounds(488, 214, 30, 30) channel("r7c12") checkbox bounds(522, 214, 30, 30) channel("r7c13") checkbox bounds(556, 214, 30, 30) channel("r7c14") checkbox bounds(590, 214, 30, 30) channel("r7c15") checkbox bounds(624, 214, 30, 30) channel("r7c16") nslider bounds(658, 214, 30, 30) range(1, 127, 0, 1, 1) velocity(1) channel("r7note") ;--- label bounds(114, 248, 30, 30) text("1") identchannel("s1") label bounds(148, 248, 30, 30) text("2") identchannel("s2") label bounds(182, 248, 30, 30) text("3") identchannel("s3") label bounds(216, 248, 30, 30) text("4") identchannel("s4") label bounds(250, 248, 30, 30) text("5") identchannel("s5") label bounds(284, 248, 30, 30) text("6") identchannel("s6") label bounds(318, 248, 30, 30) text("7") identchannel("s7") label bounds(352, 248, 30, 30) text("8") identchannel("s8") label bounds(386, 248, 30, 30) text("9") identchannel("s9") label bounds(420, 252, 30, 24) text("10") identchannel("s10") fontcolour(192, 192, 192, 255) label bounds(454, 252, 32, 24) text("11") identchannel("s11") label bounds(488, 252, 30, 24) text("12") identchannel("s12") label bounds(522, 252, 30, 25) text("13") identchannel("s13") label bounds(556, 252, 30, 24) text("14") identchannel("s14") label bounds(590, 252, 30, 24) text("15") identchannel("s15") label bounds(624, 250, 30, 25) text("16") identchannel("s16") label bounds(14, 280, 166, 39) text("RYCHTA") label bounds(14, 322, 166, 18) text("drum sequencer") checkbox bounds(288, 334, 126, 30) text("external clock") channel("extclock") rslider bounds(186, 286, 95, 55) range(1, 500, 120, 1, 1) text("BPM") channel("bpm") identchannel("bpmw") button bounds(288, 288, 80, 40) text("RUN", "STOP") channel("running") identchannel("runningw") label bounds(378, 298, 292, 17) text("there will be more features in 2020") -n -d -+rtmidi=NULL -M0 -m0d -Q0 ; Initialize the global variables. ksmps = 32 nchnls = 2 0dbfs = 1 ;instrument will be triggered by keyboard widget instr GUI kstep init 0 kextclock chnget "extclock" if kextclock==1 then kbpm chnget "HOST_BPM" kbpm limit kbpm,1,2000 krunning chnget "IS_PLAYING" chnset kbpm, "bpm" chnset krunning, "running" else krunning chnget "running" kbpm chnget "bpm" endif if changed:k(kextclock)==1 then if kextclock==1 then ; we display native clock values and disable buttons chnset "active(0)", "runningw" chnset "active(0)", "bpmw" else ; we enable buttons chnset "active(1)", "runningw" chnset "active(1)", "bpmw" endif endif kcps = kbpm / 15 ktrig metro kcps if changed:k(krunning)==1 then kstep = 0 endif if krunning==1 && ktrig==1 then Stepiden sprintfk "s%d", (kstep+1) chnset " fontcolour(255, 255, 0, 255)", Stepiden if kstep==0 then Stepidenprev sprintfk "s%d", 16 else Stepidenprev sprintfk "s%d", kstep endif chnset " fontcolour(192, 192, 192, 255)", Stepidenprev ; another massive copypasta section: krow = 1 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif krow = 2 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif krow = 3 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif krow = 4 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif krow = 5 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif krow = 6 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif krow = 7 Snoteiden sprintfk "r%dnote", krow Scheckiden sprintfk "r%dc%d", krow, (kstep+1) knote chnget Snoteiden kchecked chnget Scheckiden if knote>1 && kchecked==1 then ;printks "midiout kstatus=%d, kchan=%d, kdata1=%d, kdata2=%d\n", 0, 144, 10, knote, 100 midiout 144, 10, knote, 100 endif ;printks "step = %d\n", 0, (kstep+1) kstep = (kstep + 1) % 16 endif endin i "GUI" 0 3600