Tools: MPW
Advanced Search
Apple Developer Connection
Member Login Log In | Not a Member? Support

MPW Command Reference


Beep

Built-in

SYNTAX

Beep [frequency[,duration[,level]]]…

DESCRIPTION

The Beep command produces a beep of the specified frequency, duration, and sound level on the Macintosh speaker. If you do not specify any parameters, Beep produces a system beep, which is the alert sound you set in the Sound control panel. Note that the parameters must be specified in the order shown on the syntax line.

INPUT

None

OUTPUT

None

STATUS

Beep always returns a status code of 0.

PARAMETERS

frequency

Specifies the frequency as one of the following: a number indicating the count field for the square wave synthesizer, as described in the Sound Manager chapter of Inside Macintosh: Sound; or as a string of the following form:

[n]letter[# | b]

The latter form allows you to indicate the number (n) of intervals below or above middle C as a value between -3 and 3, the frequency (letter) as a value between A and G, and a sharp (#) or flat (b).

If you specify a sharp with the # character, enclose it or the entire parameter in which it occurs with single or double quotation marks, otherwise Beep interprets it as a comment.

duration

Specifies the length of the beep in sixtieths of a second. By default, a beep's duration is 15 (one-quarter second).

level

Specifies the sound level as a number from 0 to 255. The default level is 128.

OPTIONS

None

EXAMPLES

By omitting all parameters, the following command produces a system beep:

Beep

The following emits the three frequencies specified: C, C sharp, and D--all two intervals above middle C--for one-third, two-thirds, and one full second, respectively. Notice that the second parameter must be enclosed in single quotation marks; otherwise, the sharp character (#) indicates a comment.

Beep 2C,20 '2C#,40' 2D,60

 
 


Last Updated July 2000