form caption("Untitled") size(400, 300), colour(58, 110, 182), pluginid("def1")
keyboard bounds(8, 158, 381, 95)
button bounds(155, 81, 80, 40) channel("temp")
ksmps = 32
nchnls = 2
0dbfs = 1
;global variables...........
gkDiv init 4
gkBpm chnget "HOST_BPM"
gkTime chnget "TIME_IN_SECONDS"
gkRunning chnget "IS_PLAYING"
gkBeats init 4
gkBpm init 120
;global variables...........
instr 1;________________________________
;temporary
kRec chnget "temp"
;temporary
;variables..........
kLeng init 16
kRec init 0
kStepCount init -1
gkClock metro (gkBpm * gkDiv) / 60
gkMetro metro gkBpm / 60
;variables..........
kRecTrig trigger kRec, 0.5, 0;gets the number of times record has been called and recalled
kNumRec init 0
kNumRec += kRecTrig
kRepOn init 0
kDelRec delayk kNumRec, 0.05;# delays the start of the repeating sequence until after kStepCount has been reset
if kDelRec == 1 then
kRepOn = 1
endif
kStepCount += gkClock
if kStepCount >= kLeng then;counts and resets clock
if ((kRec == 0) || kNumRec > 1) then
if kRepOn == 1 then
kStepCount = 0
endif
endif
if kNumRec <= 1 && kRec == 1 then
kLeng = gkDiv * gkBeats * round(((kStepCount / gkDiv) / gkBeats) + 0.1)
endif
if kNumRec == 1 && kRec == 0 && kStepCount >= kLeng then
kStepCount = kStepCount - kLeng
endif
printk2 kLeng, 0, 1
printk2 kStepCount, 0, 1
printk2 kRec, 0, 1
kSeq[][] init 3, 512;#
endin
;causes Csound to run for about 7000 years...
f0 z
i1 0 z