Coyote's Guide to IDL Programming

Making the Computer Beep

QUESTION: How can I get the computer to beep programmatically?

ANSWER: The IDL documentation recommends that you print the non-printable character represented by the ASCII byte value 7:

   IDL> Print, String(7B)

But this doesn't work on most PCs. Instead, most people use the so-far undocumented (as of IDL 5.5) IDL command BEEP.


This has been found to work reliably on most machines.

Playing Window Sound Files

If you are running IDL on a Windows machine, you may want to take advantage of a DLL written by Peter Mason, an Aussie with a sense of humor in Sydney. You will need several files, which you can find in this zip file.

Place the file winclip.dll in the main IDL directory. This will be something like "C:\RSI\IDL5.5". You can place the *.wav files that come in the distribution anywhere on your IDL path. Or, you can place them with other audio files of this type in the Windows media directory. This is normally "C:\WINNT\MEDIA". You can play any file you find in the Windows media directory, or any *.wav file you have lying around, for that matter. Place the somewhere on your IDL path.

To run the program, try this:

   IDL> Bell

To play something more daring, try this:

   IDL> Bell, /AllWrong

Web Coyote's Guide to IDL Programming