Thumbnail

Sound Script (Ezb)

by Synthiam

Execute a script when sound is played out of the EZB speaker

Requires ARC v3 (Updated 1/14/2021)

How to add the Sound Script (Ezb) robot skill

  1. Load the most recent release of ARC (Get ARC).
  2. Press the Project tab from the top menu bar in ARC.
  3. Press Add Robot Skill from the button ribbon bar in ARC.
  4. Choose the Audio category tab.
  5. Press the Sound Script (Ezb) icon to add the robot skill to your project.

Don't have a robot yet?

Follow the Getting Started Guide to build a robot and use the Sound Script (Ezb) robot skill.

How to use the Sound Script (Ezb) robot skill

Execute a script when sound is played out of the EZB speaker. This robot skill will also set 3 variables for the sound level that your script loop can access. The variables include Min Level, Max Level, and Average Level.

Because the script is executed once when audio is started to play, it is advised that your on-going script is contained within a loop. Once the audio has stopped playing, the script will cancel and therefore stop running your loop.

*Note: To avoid infinite recursive run-away loops, never play an audio file or speech from the script within this skill. This means do not speak or send a ControlCommand to another control that plays audio. Doing so will call itself, which calls itself, which calls itself, which calls itself, which calls itself, which calls itself...

A simple example would be to loop and display the min, max, and average audio level values. This will be executed when the audio is started to play out of the EZB, and will stop when the audio is stopped.


print("Audio started, beginning loop");

while (true) {

  print("Min level" + getVar("$EZBAudioMinLevel"));
  print("Max level" + getVar("$EZBAudioMaxLevel"));
  print("Avg level" + getVar("$EZBAudioAvgLevel"));  
}


ARC Pro

Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.