AudioLoadTone

Top  Previous  Next

Message

 

AudioLoadTone <audiodevicenumber>|<alias> <soundname> <frequency> square|sine|sawtooth|tone [<duration_ms>]

 

Originator

 

Client

 

Response

 

SyntaxError: insufficient parameters to AudioLoadTone

SyntaxError: invalid parameters to AudioLoadTone

Error: failed to load Tone on Audio <audiodevicenumber> (<alias>)

Info: loaded Tone on Audio <audiodevicenumber> (<alias>)

 

Response (immediate socket)

 

Success

Failure

 

Details

 

Loads (creates) a simple tone of given frequency (Hz) and gives the sound a name; the sound can be used in exactly the same way as a WAV sound loaded with AudioLoadSound.

 

The waveform of the tone can be chosen from:

Sine – gives a pure sinusoidal form
Square – gives a square wave
Sawtooth – gives an asymmetric (|/|/|/|/|/|/) form
Tone – a modified waveform similar to the sinusoid, but containing more energy; this results in a better sound with a range of frequencies.

 

The optional <duration_ms> parameter sets the duration in milliseconds (default: 1000 ms, or 1 s).

 

To play the sound for long periods, consider setting a short sound to repeat (AudioPlaySound -loop) and cancel it after the desired time.

 

Revision history

 

Implemented by WhiskerServer version 2.3.

 

See also

 

Audio devices
AudioPlaySound
AudioLoadSound
AudioGetSoundLength