Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
17
Task/Metronome/Wren/metronome.wren
Normal file
17
Task/Metronome/Wren/metronome.wren
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import "timer" for Timer
|
||||
import "io" for Stdout
|
||||
|
||||
var metronome = Fn.new { |bpm, bpb, maxBeats|
|
||||
var delay = (60000/bpm).floor
|
||||
var beats = 0
|
||||
while (true) {
|
||||
Timer.sleep(delay)
|
||||
System.write((beats % bpb == 0) ? "\n\aTICK " : "\atick ")
|
||||
Stdout.flush()
|
||||
beats = beats + 1
|
||||
if (beats == maxBeats) break
|
||||
}
|
||||
System.print()
|
||||
}
|
||||
|
||||
metronome.call(120, 4, 20) // limit to 20 beats
|
||||
Loading…
Add table
Add a link
Reference in a new issue