Cochlea — Claude Code MCP server: render and analyze audio offline
MCP server for offline audio rendering from RON scores and detailed analysis of WAV, FLAC, mp3, ogg without playback — agent gets JSON with loudness, pitch, onsets, tempo and a spectrogram.
Open on GitHubWhat Cochlea does
Agent writes a score as data (RON format), renders PCM with cochlea render, then reads the result via cochlea probe — JSON report with integrated loudness (LUFS), true peak, onsets, recognized notes in pitch.melody, key, tempo and MFCC. Spectrogram is generated to PNG with one cochlea spectro command for a single vision call instead of iterating over samples. Loop closes with cochlea render --verify: assertions embedded in the score (.true_peak_below(), .pitch_matches_score(), .silent_after()) are checked automatically, agent retries without human confirmation.
All tools read WAV, FLAC (bit-exact decode), mp3 and ogg; FFmpeg not needed. --from and --to flags cut frame-exact fragments, report times are recalculated relative to the slice. Score specifies tempo, time signature, tracks with instrument presets (Instrument::preset("saw_lead")), notes and parameter automation (cutoff, resonance) on a tick-based timeline. Economics: a 3-minute render is ~66 MB of PCM, its probe report is a few KB of JSON.
What it helps with
- render audio from a score without a DAW and verify the result programmatically
- analyze loudness, pitch, onsets and tempo of any audio file via JSON
- generate a spectrogram for the agent instead of reading samples
- check score assertions (peak, pitch, silence) automatically
- import MIDI to score format or transcribe audio back to a score
Example prompts for the agent
- Render the score from
beat.rontomix.wavand run assertion checks - Analyze
vocal.mp3from 42 to 44.5 seconds, output JSON with onsets and pitch - Draw a mel spectrogram of
drums.wavtospec.pngwith beat and onset annotations
How to install Cochlea
Install
The MCP registry has no launch command for it: see the repository README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Cochlea
How to install Cochlea in Claude Code?
Add the MCP server to Claude Code config, pointing to the cochlea executable with the mcp argument. Build the binary from the richer-richard/cochlea repository with cargo build --release.
What does Cochlea do?
Renders audio from a score (RON format) to deterministic PCM, analyzes WAV/FLAC/mp3/ogg without playback — outputs JSON with loudness, onsets, recognized notes, tempo, key and a spectrogram as PNG. Agent can check embedded score assertions automatically.
Which formats does cochlea probe read?
WAV, FLAC (bit-exact decode), mp3 and ogg. FFmpeg not required; score is only needed for render and verify, analysis works with any audio file.