Spiffing Up Batch Files With Sound
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Boring batch files got you down? Add some sound! There's no "beep" 
command for DOS, but you can generate a beep in an ECHO statement by 
holding down the ALT key and (making the sure the NUM LOCK light is on) 
typing 007 on the numeric keypad. Try typing in and running this batch 
file -- remember to press ENTER after every line. (That ^G at the end of 
the ECHO command is the beep; again, you generate it by holding down ALT 
and pressing 007.)

C:\>COPY CON BEEPTEST.BAT
@ECHO OFF
ECHO GONNA BEEP NOW^G
CTRL-Z

Now type BEEPTEST and listen. Cool, huh? Note that when you display the 
BEEPTEST.BAT file using the DOS TYPE command, you can't see the beep 
anymore (the ^G is gone), but you can sure hear it.

   If you'd like to add beeps to existing batch files, use the EDIT 
program that comes with DOS 5 and 6. At the end of the ECHO line in which 
you want to add sound, press CTRL-P to go into EDIT's "Insert Special 
Character" mode, then press ALT-007. In EDIT you see the beep as a bullet 
character, like so:

ECHO Delete these files? Press CTRL-C to abort
PAUSE

   Beeps come in handy when batch files are involved in potentially 
dangerous activities such as deleting files. A well-placed beep just might 
prevent unfortunate accidents.


Sound Fun With the Norton Utilities

   If you have Norton Utilities' Batch Enhancer (BE) in your path, you 
don't have to bother with the ALT-key combinations to generate a beep: 
just insert the command BE BEEP in your batch file.

   Want to get fancy? You can create all sorts of musical beeps using the 
BE BEEP switches shown in Figure 1. The Duration and Wait values are in 
18ths of a second. So the command BE BEEP /F880 /R2 /D18 /W6 would play an 
'A' note (/F880) twice (/R2) over a period of a second (/D18), and the 
second beep occurs after a one-third second wait (/W6; 6/18 = 1/3). As 
another example, the following command lines generate a short batch file 
you can execute to play a simple fanfare:

COPY CON FANFARE.BAT
BE BEEP /F262 /D5
BE BEEP /F262 /D2 /R2 /W1
BE BEEP /F349 /D15
CTRL-Z

    _______________________________________________________________
   |                                                               |
   |  /Fx   x = frequency of notes to play                         |
   |  /Rx   x = number of times to repeat note                     |
   |  /Dx   x = duration of note(s) in 1/18ths of a second         |
   |  /Wx   x = time to wait between notes in 1/18ths of a second  |
   |                                                               |
   |---------------------------------------------------------------|
   |                 Figure 1: BE BEEP Switches                    |
   |_______________________________________________________________|


   See Figure 2 for some neat BE BEEP tunes we've assembled into batch 
files for you Norton users. Try 'em out. If you like them, just cut and 
paste their statements into your own batch files.

    ________________________________
   |                                |
   |  COPY CON ZARATHUS.BAT         |
   |  @ECHO OFF                     |
   |  BE BEEP /F262 /D18            |
   |  BE BEEP /F392 /D18            |
   |  BE BEEP /F523 /D40            |
   |  BE BEEP /F659 /D1             |
   |  BE BEEP /F623 /D18            |
   |  CTRL-Z                        |
   |                                |
   |  COPY CON TWINKLE.BAT          |
   |  @ECHO OFF                     |
   |  BE BEEP /F523 /D2 /R2         |
   |  BE BEEP /F784 /D2 /R2         |
   |  BE BEEP /F880 /D2 /R2         |
   |  BE BEEP /F784 /D6             |
   |  CTRL-Z                        |
   |                                |
   |  COPY CON THE5TH.BAT           |
   |  @ECHO OFF                     |
   |  BE BEEP /F330 /D1 /R3         |
   |  BE BEEP /F262 /D24            |
   |  BE BEEP /F294 /D1 /R3         |
   |  BE BEEP /F247 /D24            |
   |  CTRL-Z                        |
   |                                |
   |--------------------------------|
   | Figure 2: Sample BE BEEP Tunes |
   |________________________________|


   Figure 3 provides a frequency-to-musical note relationship chart; you 
may need it when putting together your own musical beeps. You can also use 
these frequencies for SOUND statements in GW-BASIC and QBASIC.

   You can make different beeps means different things in your batch 
files. For example, insert high-pitched or up-scaling beeps to let you 
know when the batch file has finished its task, and down-scaling beeps to 
signify error conditions.

    _______________________________________________________________
   |                                                               | 
   |  NOTE FREQUENCIES                                             |
   |                                                               |
   |         Octave 1   Octave 2   Octave 3   Octave 4   Octave 5  |
   |                                                               |
   |  C        262        523*       1047       2093       4186    |
   |  C#       278        555        1111       2221       4442    |
   |  D        294        587        1175       2349       4699    |
   |  D#       312        623        1247       2493       4986    |
   |  E        330        659        1319       2637       5274    |
   |  F        349        698        1397       2794       5588    |
   |  F#       371        741        1482       2965       5930    |
   |  G        392        784        1568       3136       6272    |
   |  G#       416        832        1664       3328       6656    |
   |  A        440        880        1760       3520       7040    |
   |  A#       467        934        1868       3736       7471    |
   |  B        494        988        1976       3951       7902    |
   |                                                               |
   |   * Middle C                                                  |
   |                                                               |
   |---------------------------------------------------------------
   |                Figure 3: Musical Frequencies                  |
   |_______________________________________________________________|

-=--------------        -=*=-     -=*=-     -=*=-        --------------=-
