Skip to main content
Glama

Detect onsets

detect_onsets

Detects drum hits (kick, snare, hi-hat) in live audio and outputs per-band pulse signals for reactive visuals. Broadcasts onset events for AI integration.

Instructions

Build a transient/onset detector that flags kick/snare/hi-hat hits in live audio and exposes a per-band pulse channel (a 0→1 spike on each hit) on a Null CHOP. Unlike create_tempo_sync (a fixed internal clock), this follows the ACTUAL audio: bind a parameter to op('…/onsets/onsets')['kick'] to flash or cut exactly on the kick drum. Each band is built from primitives (band filter → RMS energy → moving-baseline compare → threshold), so a Threshold knob tunes hit sensitivity and a Sensitivity knob scales the output. Source can be the live device (mic/line — may prompt for macOS permission), an audio file, a synthetic oscillator (for testing), or an existing CHOP. With emit_events on, it also broadcasts an onset event over the bridge WebSocket on each hit. The audio-following complement to create_tempo_sync.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceNoAudio source. 'device' = live microphone/line in (the real-world default; creating it may pop a one-time macOS microphone-permission dialog — click Allow). 'file' = an audio file. 'oscillator' = a synthetic tone, handy for testing without any device permission. 'existing_chop' = reuse a CHOP you already have.device
audio_file_pathNoAudio file path (source='file').
existing_chop_pathNoPath of an existing audio CHOP to analyze (source='existing_chop').
kick_hzNoLow-pass cutoff (Hz) isolating the kick/bass-drum band.
snare_hzNoBand-pass centre (Hz) isolating the snare/body band.
hat_hzNoHigh-pass cutoff (Hz) isolating the hi-hat/cymbal band.
thresholdNoHow far an instant's band energy must rise above its own moving baseline (in RMS units) to count as a hit. Band-RMS magnitudes are small (a steady tone reads ~0.002 live), so the default is 0.01 — the old 0.15 was unreachable and never fired. Lower = more sensitive; raise it if a loud track double-triggers. Tune live per source (needs real percussive audio to dial in).
emit_eventsNoAlso broadcast an `onset` event over the bridge WebSocket on every detected hit (with the band name), so `tdmcp-agent watch` and the AI can react to drum hits live.
expose_controlsNoExpose live 'Sensitivity' (output gain) and 'Threshold' (hit sensitivity) knobs.
parent_pathNoParent COMP path the self-contained 'onsets' container is created inside./project1
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations show readOnlyHint=false and destructiveHint=false. The description adds valuable context: it creates a self-contained 'onsets' container, may prompt macOS microphone permission, and can emit WebSocket events. This goes beyond annotations to inform the agent of side effects and prerequisites.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose and well-structured. It is dense with information but not overly verbose, though some sentences could be tightened slightly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 10 parameters, no output schema, the description covers inputs comprehensively and explains what the tool produces (pulse channels, event emissions). It also describes the internal processing chain, making the tool's behavior fully understandable.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, baseline 3. The description adds meaning beyond the schema by explaining the rationale behind the threshold default change (old 0.15 unreachable) and the internal band chain. This enriches the agent's understanding beyond raw parameter descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it builds a transient/onset detector for kick/snare/hi-hat hits from live audio, exposing per-band pulse channels. It distinguishes itself from create_tempo_sync (fixed clock vs actual audio), so the purpose is specific and well-differentiated.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly contrasts with create_tempo_sync and explains when to use this tool (for actual audio-following). Source options are detailed with use-case guidance (e.g., oscillator for testing). However, it does not include explicit 'when not to use' scenarios beyond the alternative.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Pantani/tdmcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server