Inverted Pendulum icon Inverted Pendulum Balancing controller for Sainsmart v3 (and compatible) robots: PID tuning, real‑time telemetry, angle offset, movement and calibration via ARC. Try it →
Asked
Microphone clap trigger on Darwin Mini

Microphone Clap Trigger On Darwin Mini

Working on a ROBOTIS Darwin Mini (OpenCM9.04 flashed with the ARC firmware from the Synthiam hardware page), connected to ARC over USB for now. Servos (XL-320s) move fine using Auto Position frames, so the control link seems solid. I’m trying to add a simple audio interaction: clap once to make the Mini do a "cheer" pose, and also capture a 2-second snippet of the clap/voice and play it back through my PC speakers. I added the Microphone skill and the waveform/levels look good. Manually pressing "Record" then "Export to Sound Board (EZB)" works-the clip shows up in my Sound Board (EZB) and I can play it. But I’m stuck automating it from a script and reliably detecting the clap.

Questions/issues I’m hitting:

  • I can’t find a reliable variable or event to detect a short, sharp clap; the Auto Record threshold triggers too often on ambient noise with my laptop mic. Is there a way to read a current mic RMS/peak value or get a boolean "above threshold" variable that I can debounce in JavaScript?
  • What are the exact ControlCommand strings for the Microphone skill to 1) start/stop a timed recording and 2) export the latest buffer to a specific Sound Board (EZB) control? I tried guesses like:
ControlCommand("Microphone", "RecordFor", 2000);
Sleep(2200);
ControlCommand("Microphone", "ExportToSoundBoard", "Sound Board (EZB)");
ControlCommand("Sound Board (EZB)", "Track_0");

but nothing updates on the Sound Board unless I click Export manually. Also, any tips for clap detection filtering (e.g., simple moving average) in ARC JavaScript so my Darwin Mini only fires the Auto Position frame on a real clap?

What is the correct way in ARC to read a clap-like peak from the Microphone skill and then programmatically export/play the latest recording via Sound Board (EZB) while triggering an Auto Position on a Darwin Mini connected over USB?



Related Hardware (view all EZB hardware)
Darwin Mini by Robotis
ROBOTIS MINI for Synthiam ARC: 16 XL-320 servos, OpenCM9.04 controller, 3D-printable frame and Bluetooth/firmware setup tips.
USB / Bluetooth
Servos 16
Camera
Audio
UART
I2C
ADC
Digital

Related Robot Skills (view all robot skills)
Soundboard (EZB) by Synthiam
Play WAV/MP3 via EZ-B v4, manage tracks, add timed scripts for synced robot actions, control via ControlCommand(), volume and clipping indicators.
Microphone by Synthiam
Record audio from your PC mic, auto-trigger and edit sample rate/effects, then play or export recordings to an EZ-B v4 SoundBoard for robot playback.

ARC Pro

Upgrade to ARC Pro

Stay at the forefront of robot programming innovation with ARC Pro, ensuring your robot is always equipped with the latest advancements.

Author Avatar
PRO
Canada
Twitter YouTube GitHub
#1  

Yes - you can build this in ARC, but there are a couple of important limitations to know first:

What ARC can and can’t do with the Microphone skill

The Microphone skill is primarily a recording tool, not a live waveform analysis API. So:

  • There is not a built-in public variable that exposes real-time RMS/peak/clap level
  • There is not a simple "above threshold" value you can poll directly from JavaScript
  • The Auto Record feature is internal to the skill, so it’s not ideal for precise clap detection

That means the most reliable path is usually:

  1. Use the Microphone skill only for recording
  2. Do your clap detection externally in JavaScript or Python by reading from the mic input through a script-compatible path, or
  3. Use a small custom robot skill if you need true live mic level access

If you want a reusable solution inside ARC, the best long-term approach would be creating a custom robot skill: https://synthiam.com/Support/Create-Robot-Skill/Overview


About the Microphone skill commands

The exact ControlCommand() strings for the Microphone skill are not always obvious from the UI, and they depend on that skill’s documented commands. Since the public documentation doesn’t list a timed-record/export command set in the same way some other skills do, the safest way is:

  1. Open the Microphone skill
  2. Click the kebab/hamburger menu in the top-right of the skill
  3. Look for its settings/help/control command list
  4. In ARC, use the Cheat Sheet in the script editor to inspect available commands for that skill

If a command isn’t listed there, ARC won’t accept guessed names like "RecordFor" or "ExportToSoundBoard".


Important note about your Sound Board test

You mentioned:

manually pressing "Export to Sound Board (EZB)" works

That means the connection is fine.

But the export button is a UI action inside the Microphone skill, and many skills don’t expose every UI action as a ControlCommand(). So the issue is probably not your syntax - it’s likely that the Microphone skill doesn’t currently expose that export action through ControlCommand().


Best practical architecture for your goal

For your use case on the Darwin Mini:

  • Auto Position: trigger your cheer pose
  • Microphone: manual/automatic recording only if supported
  • Sound Board (EZB): play back the exported clip
  • JavaScript: handle the logic and debounce

Example flow

  1. Detect clap
  2. Trigger Auto Position "Cheer"
  3. Start recording for 2 seconds
  4. Stop recording
  5. Export recording if the Microphone skill supports it
  6. Play the sound from Sound Board

How to make clap detection more reliable

Because the built-in mic skill doesn’t expose raw live audio levels, you’ll need a workaround. Common options:

Option A: Use speech recognition / audio trigger style detection

If your clap is consistent and loud, you may be able to detect it with a short audio trigger window.

Option B: Use a custom script skill or robot skill

This is the cleanest solution if you want:

  • peak detection
  • moving average smoothing
  • threshold debounce
  • clap-only triggering

Option C: Use a Python/JavaScript loop with a separate audio source

If you have access to audio input via a scriptable source, you can:

  • sample mic data
  • calculate amplitude
  • compare against threshold
  • require a second "quiet" window before re-arming

Debounce idea in JavaScript

If you can get any kind of live amplitude value, a simple clap detector would look like this:

var threshold = 180;
var clapCooldownMs = 1200;
var lastClapTime = 0;

function isClap(currentLevel, smoothedLevel) {
  return currentLevel > threshold && smoothedLevel > threshold * 0.7;
}

function triggerCheer() {
  controlCommand("Auto Position", "AutoPositionAction", "Cheer");
}

while (true) {
  // Replace this with your actual mic level source if you have one
  var currentLevel = 0;

  if (currentLevel > threshold) {
    var now = new Date().getTime();
    if (now - lastClapTime > clapCooldownMs) {
      lastClapTime = now;
      triggerCheer();
    }
  }

  sleep(20);
}

That said, this only works if you have a real level reading source.


Triggering the Darwin Mini cheer pose

If your Auto Position action is named Cheer, then the ControlCommand would typically be:

controlCommand("Auto Position", "AutoPositionAction", "Cheer");

If your control is renamed, use that exact title instead.


What I recommend you do next

  1. Open the Microphone skill’s hamburger/kebab menu
  2. Check whether it exposes any ControlCommands
  3. If it does not expose timed record/export commands, you’ll need either:
    • a custom robot skill, or
    • a different audio-detection approach
  4. Use the ARC AI Assistant inside the script editor to help rewrite or build the JavaScript logic directly: https://synthiam.com/Products/AI-Assistant

For your specific setup

Since you’re on a Darwin Mini over USB and your motion side is already working, I’d focus on two separate pieces:

  • Motion: trigger the cheer pose with Auto Position
  • Audio: handle clap detection using a more direct method than the Microphone skill alone

If you want, I can help you with either of these next:

  1. Write a clean ARC JavaScript debounce script for clap-triggered Auto Position, or
  2. Figure out the exact Microphone/Sound Board ControlCommands by walking through the skill menus with you.

If you can share a screenshot of the Microphone skill settings/menu and the Cheat Sheet for that control, I can help identify the exact command names.

I am a customer support AI and still learning. Please verify important answers in our support documentation. For advanced AI features, use the AI Script Agent built into ARC.