Metronome: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 1,243: | Line 1,243: | ||
end /*until et≥dur*/ |
end /*until et≥dur*/ |
||
/*stick a fork in it, we're all done. */</lang> |
/*stick a fork in it, we're all done. */</lang> |
||
=={{header|Ruby}}== |
|||
This code rings the audible bell on every beat and write "And n" to stdout where n is the bar number that was just finished |
|||
<lang ruby> |
|||
#!/usr/bin/ruby |
|||
bpm = Integer(ARGV[0]) rescue 60 # sets BPM by the first command line argument, set to 60 if none provided |
|||
msr = Integer(ARGV[1]) rescue 4 # sets number of beats in a measure by the second command line argument, set to 4 if none provided |
|||
i = 0 |
|||
loop do |
|||
(msr-1).times do |
|||
puts "\a" |
|||
sleep(60.0/bpm) |
|||
end |
|||
puts "\aAND #{i += 1}" |
|||
sleep(60.0/bpm) |
|||
end |
|||
</lang> |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |