Velocity API: Device.beep()

Version 2

    Return To Index



    Plays a tone through the speaker of the mobile device.

    Use Cases

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


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



    Device.beep(frequency, durationMilliseconds, trailingSilence);
    frequencyTone frequency in hertz.NumberRequiredInteger between 100 and 2000
    durationMillisecondsDuration of the tone in milliseconds, where 1000 milliseconds is equal to 1 second.NumberRequiredInteger between 1 and 100000
    trailingSilenceAmount of time in milliseconds that no tone should be played.NumberRequiredInteger between 0 and 100000


    Example 1

    /* The device will beep for a duration of 500 milliseconds 
    * with a 50 millisecond trailing silence.

    Example 2

    /* The scan beep is replaced with a tada.wav. */     
    WLEvent.on("Beep", function (event) {
         if(event.type == "3")
         event.eventHandled = true;