Velocity API: Device.errorBeep()

Version 1

    Return To Index

    Device.errorBeep()

    Overview

    Plays an error beep through the device's speaker. An error beep is a two-toned beep with the first beep higher than the second beep.

    Use cases

    • You want your script to play an error beep.
    • You want to override the default beeps using WLEvent.on(“beep”, …) and play a custom error beep(s) instead.

    Remarks

    Calls to Device.errorBeep() are asynchronous and added to a beep queue, meaning that this call will immediately return.

    Format

     

    Device.errorBeep(frequency, durationMilliseconds, trailingSilence);
    ParameterDescriptionTypeRequiredNotes
    frequencyTone frequency in hertz for the second beep. The first beep will be pitched higher by 400Hz.NumberRequiredInteger between 100 and 2000
    durationMillisecondsDuration of a regular beep in milliseconds. An error beep is 4x longer than a regular beep. For example, if you specify 500 ms, the first tone beeps for 1000 ms and the second tone beeps for 1000 ms, making the total duration of the error beep 2000 ms.NumberRequiredInteger between 1 and 100000
    trailingSilenceAmount of time in milliseconds that no tone should be played after the second beep.NumberRequiredInteger between 0 and 100000

     

    Example

    /* The device will beep twice, once at 800Hz and once at 400Hz, for a total duration of 2000 
    * milliseconds with a 50 millisecond trailing silence
    * after the second beep.
    */
      
    Device.errorBeep(400,500,50);