Skip to main content
Glama

Detect pitch (experimental)

detect_pitch

Estimates dominant musical pitch from live audio, audio file, or synthetic tone. Outputs frequency, MIDI note, and confidence for driving visuals or parameters.

Instructions

EXPERIMENTAL monophonic pitch tracker. Estimates the dominant musical pitch of live audio and exposes pitch_hz (frequency in Hz), note (MIDI note number), and confidence (peak magnitude) on a Null CHOP — bind a colour/parameter to op('…/pitch/pitch')['pitch_hz'] to drive visuals from a melody. Built entirely from stock CHOPs (the Pitch CHOP isn't createable in this build): an Audio Spectrum CHOP in 1-sample-per-Hz mode, trimmed to a [min_hz, max_hz] search band, then an Analyze CHOP argmax (highestpeakindex) whose index IS the frequency. A Threshold knob mutes the pitch when nothing is clearly playing and a Sensitivity knob scales the magnitude. Source can be the live device (mic/line — may prompt for macOS permission), an audio file, a synthetic sine oscillator (for testing), or an existing CHOP. Caveats: ~1 Hz resolution, no harmonic/octave correction, monophonic only — approximate and best tuned live.

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 (a SINE wave at a fixed frequency → a clean single peak, the ideal device-free test for pitch tracking). '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').
min_hzNoBottom of the frequency search range (Hz). The dominant-bin search ignores everything below this, so sub-bass rumble / DC offset can't masquerade as the pitch. 80 Hz ≈ low male voice / bass guitar E.
max_hzNoTop of the frequency search range (Hz). The search ignores everything above this. 2000 Hz comfortably covers the fundamental of most melodic instruments and voice; raise it for piccolo/whistle, lower it to reject high harmonics.
expose_controlsNoExpose live 'Sensitivity' (magnitude gain) and 'Threshold' (minimum peak magnitude below which the pitch is treated as silence) knobs.
parent_pathNo/project1
Behavior5/5

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

Beyond the minimal annotations (readOnlyHint=false, destructiveHint=false, openWorldHint=true), the description details internal pipeline (Audio Spectrum CHOP, Analyze CHOP argmax), exposes that source='device' may trigger macOS permission dialog, and lists caveats like ~1 Hz resolution. No contradictions with annotations.

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 rich but well-organized: purpose, outputs, internal mechanism, controls, sources, caveats. It could be slightly tighter but every sentence adds value. The structure is logical and front-loaded with key information.

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 no output schema, the description effectively explains return values (pitch_hz, note, confidence on a Null CHOP) and usage. It covers 7 parameters, internal pipeline, source options, and limitations, making it highly complete for a complex tool.

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

Parameters5/5

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

With high schema coverage (86%), the description significantly adds context: explains min_hz and max_hz as frequency search range, describes Threshold and Sensitivity knobs, and thoroughly explains each source option including the oscillator for testing and device permission prompt. This goes well beyond the schema 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 is an EXPERIMENTAL monophonic pitch tracker that estimates dominant musical pitch and exposes pitch_hz, note, and confidence. This distinguishes it from siblings like detect_onsets or extract_audio_features by being a dedicated pitch tracking tool.

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 provides clear usage context: for driving visuals from melody using a Null CHOP, with caveats about monophonic, no harmonic correction, and approximate results. It explains that it is built from stock CHOPs because the Pitch CHOP is unavailable. However, it lacks explicit comparison to other tools for audio analysis.

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