Home Contents | # audio.beep | Audio | Core4 Lua Commands

## SYNOPSIS

1. audio.beep(type, freq, length [, attack, decay, sustain, release])
2. audio.pause(length)

## DESCRIPTION

Generates a beep signal. type specifies the shape ("square", "sawtooth", "triangle" or "sine"), freq the frequency and length the time in ms.

Optionally, an ADSR envelope can be specified. The values for attack, decay and release are in ms, while sustain is given in percent (0 ... 100). The sum of attack, decay and release must not be greater than length.

If the audio daemon is running, the beep signal is put onto the digital audio output. Without digital audio hardware or no daemon running, code tries a best effort on the piezo buzzer, if available. The buzzer ignores the type value and any ADSR envelope, doing square waves only.

The audio.pause() command inserts length ms of silence into the audio.

All beep requests are buffered and processed concurrently. The Lua program continues while beeps and pauses are processed.

## EXAMPLE

>
audio.beep("square", 4000, 100)

## SEE ALSO

audio.buzz, audio.mix, audio.mixers, audio.play, audio.source, audio.sources, audio.vol