Purpose: | Beep the speaker or play simple music |
Format: | BEEP [frequency duration ...] [asterisk | exclamation | hand | question | ok] |
frequency | The beep frequency in Hertz (cycles per second). |
duration | The beep length in 1/18th second intervals. |
asterisk | Plays the system default "asterisk" sound. |
exclamation | Plays the system default "exclamation" sound. |
hand | Plays the system default "hand" sound. |
question | Plays the system default "question" sound. |
ok | Plays the system default "ok" sound. |
Usage:
BEEP generates a sound through your computer's speaker. You can use it in batch files to signal that an operation has been completed, or that the computer needs attention.
Because 64-bit versions of Windows do not support playing sounds through the Windows Beep API, TCC-RT uses DirectSound for BEEP.
Because BEEP allows you to specify the frequency and duration of the sound, you can also use it to play simple music or to create different kinds of signals for the user.
You can include as many frequency and duration pairs as you wish. No sound will be generated for frequencies less than 20 Hz, allowing you to use BEEP as a way to create short delays. The default value for frequency is 440 Hz; the default value for duration is 2.
Numeric input may be entered in either decimal format (a sequence of 0-9 digits) or in hexadecimal format ("0x" followed by a sequence of 0-F hex digits).
The following table gives the frequency values for a five octave range (middle C is 262 Hz):
C |
131 |
262 |
523 |
1046 |
2096 |
C# / Db |
139 |
277 |
554 |
1108 |
2217 |
D |
147 |
294 |
587 |
1175 |
2349 |
D# / Eb |
156 |
311 |
622 |
1244 |
2489 |
E |
165 |
330 |
659 |
1318 |
2637 |
F |
175 |
349 |
698 |
1397 |
2794 |
F# / Gb |
185 |
370 |
740 |
1480 |
2960 |
G |
196 |
392 |
784 |
1568 |
3136 |
G# / Ab |
208 |
415 |
831 |
1664 |
3322 |
A |
220 |
440 |
880 |
1760 |
3520 |
A# / Bb |
233 |
466 |
932 |
1866 |
3729 |
B |
248 |
494 |
988 |
1973 |
3951 |
Example:
This batch file fragment runs a program called DEMO, then plays a few notes and waits for you to press a key:
demo
beep 440 4 600 2 1040 6
pause Finished with the demo - hit a key...