Skip to main content

Sound playback and vibration

Indicating item presses, events, and notifications with sound and vibration

Sound and vibration on a button press​

Phones and tablets equipped with a vibration motor can play a sound or vibrate when an item is pressed.

Sound control uses a set of commands (macros) in graphic item properties:

Studio2019_Sound_macro.png

Sounds (sound control):

  • Play sound (file, track number, volume, loop). Start playing an audio file
  • Play system sound (sound, track number, volume). Play a standard sound
  • Stop sound (file). Stop playing an audio file
  • Stop slot (track number). Stop playing the audio file on the specified track
  • Stop all sounds. Stop all sound playback in the project

More about macro commands >>>

Vibration requires activating the project's system token Device > Vibro, available in the system-token list. At the time of writing, the token accepts only 1, meaning "vibrate". Vibration lasts 1 second; its duration cannot be changed.

To activate the token when a button is pressed, use Send number to tag from Send to project token. Write the number 1 :

Studio2019_Vibro_macro.png

Sound and vibration on a system event​

Any event, such as a variable or token change or a specified time, can trigger sound playback and other actions. A common task is to show a warning popup and play a sound if the control system fails or an intercom call arrives.

A simple script can associate an event with an action.

Example: play a sound, vibrate, and open a popup when feedback "1/0/2" of the "iRidi Server" driver becomes 1

IR.AddListener(IR.EVENT_TAG_CHANGE, IR.GetDevice("iRidi Server"), function(name, value)
{
// if the feedback "1/0/2" of "iRidi Server" changes to value 1
if (name == "1/0/2" && value == 1) {
// play sound, all slots, volume: 50
IR.PlaySound('Sounds1_0012.mp3', 0, 50);
// vibration
IR.SetVariable("System.Vibro", true);
// open popup "Alarm"
IR.ShowPopup("Alarm");
}
});

For all event and action types, see the guide and reference for JavaScript in iRidi.

Push notification sounds​

When i3 pro is open in the foreground on a phone or tablet, a Push notification does not play a sound or display a popup notification.

To avoid missing notifications, configure handling inside i3 pro: the interface must show a popup and play a sound when a notification arrives. To do this:

Read section 4.1 of the Push setup instructions >>>

IP cameras with audio support​

Some IP cameras, such as Mobotix, can transmit an mxpeg video stream containing an audio track. To play sound on an IP-camera page, select Audio in the camera settings:

Studio2019_IPCam_audio.png

Other IP-camera settings >>>

SIP telephony: call sounds​

Ready-made SIP telephony interfaces handle call sounds:

  • When i3 pro is open, it plays a ringtone
  • When the application is minimized or closed, you can configure a long signal on receipt of a Push call notification:

See SIP telephony solutions >>>