The Mathematica Journal
Volume 9, Issue 2


In This Issue
Tricks of the Trade
In and Out
Trott's Corner
New Products
New Publications
News Bulletins
New Resources

Download This Issue 

About the Journal
Editorial Policy
Back Issues
Contact Information

In and Out
Edited by Paul Abbott

Beeping Progress

Q: How can I play a sound to alert me regarding my program's progress during a long looping procedure?

A: You can use the built-in Message mechanism. You can specify the required (default) behavior of Message by setting WarningAction to include Beep as follows:

1. Open the Option Inspector by clicking Format Option Inspector. Make sure the scope is global.

2. Locate WarningAction by typing in "warning" in the Lookup text field.

3. Modify WarningAction to include Beep.

Add a message displaying the iteration number (see Section 2.9.21 of The Mathematica Book).

Redundant or repetitive messages are, by default, suppressed in long calculations; therefore, you should turn off General::stop (see General::stop in the Reference Guide).

From your loop, call this message.

Alternatively, if you have suitable text-to-speech system software installed on your system, you can ask the front end to "speak" the given text, which should be a text string.

To set the speaking voice, use FrontEndExecute[SetSpeechParametersPacket[i]] where i is a number between 1 and the number of voices you have installed. (For further information, see the following The Mathematica Journal articles: "Tricks of the Trade" (SetNotebookStatusLine), 7 (3), 1999 p. 263, and "In and Out" (Why the Beep?), 8 (3), 2002 p. 400.)

About Mathematica | Download Mathematica Player
Copyright © Wolfram Media, Inc. All rights reserved.