Anonymous user
Metronome: Difference between revisions
→{{header|REXX}}: added output to the 1st REXX program, changed/added comments, whitespace, and indentations.
m (→with sound, REGINA only: added a comment to a REXX section header.) |
(→{{header|REXX}}: added output to the 1st REXX program, changed/added comments, whitespace, and indentations.) |
||
Line 1,019:
These REXX program examples are modeled after the Perl 6 example.
===textual visual, no sound===
<lang rexx>/*REXX program simulates a visual (textual) metronome (with no sound). */
parse arg bpm bpb dur . /*obtain optional arguments from the CL*/
if bpm=='' | bpm==
if bpb=='' | bpb==
if dur=='' | dur==
call time '
bt=1/bpb /*calculate a tock-time interval. */
do until et>=dur; et=time('
say; call charout ,'TICK' /*show the first tick for the period. */
es=et+1 /*bump the elapsed time "limiter". */
end /*until
/*stick a fork in it, we're all done. */</lang>
'''output''' when using the default inputs:
<per>
TICK tock tock tock tock
TICK tock tock tock tock
TICK tock tock tock tock
TICK tock tock tock tock
TICK tock tock tock tock
TICK tock tock tock tock
===with sound, REGINA only===
This REXX version ''only'' executes when using the Regina REXX interpreter.
<lang rexx>/*REXX program simulates a metronome (with sound)
parse arg bpm bpb dur tockf tockd tickf tickd . /*obtain optional arguments from the CL*/
if bpm==''
if bpb==''
if dur==''
if tockf=='' | tockf==
if tockd=='' | tockd==
if tickf=='' | tickf==
if tickd=='' | tickd==
call time '
bt=1/bpb /*calculate a
do until et>=dur; et=time('
call beep tockf, tockd /*sound a beep for the "TOCK". */
es=et+1 /*bump the elapsed time "limiter". */
end /*until
/*stick a fork in it, we're all done. */</lang>
▲</lang>
===with sound, PC/REXX only===
<lang rexx>/*REXX program simulates a metronome (with sound)
parse arg bpm bpb dur tockf tockd tickf tickd . /*obtain optional arguments from the CL*/
if bpm==''
if bpb==''
if dur==''
if tockf=='' | tockf==
if tockd=='' | tockd==
if tickf=='' | tickf==
if tickd=='' | tickd==
call time '
bt=1/bpb /*calculate a
do until et>=dur; et=time('
call sound tockf, tockd /*sound a beep for the "TOCK". */
es=et+1 /*bump the elapsed time "limiter". */
end /*until
/*stick a fork in it, we're all done. */</lang>
=={{header|Tcl}}==
|