TypeScript · Vercel AI SDK

sound-recreation-agent

An AI agent that reverse-engineers keyboard sounds from songs and applies them to hardware synthesizers via MIDI. Powered by Vercel AI SDK's ToolLoopAgent and the Model Context Protocol.

ToolLoopAgent MCP over stdio Stateless server
★ View on GitHub Read the docs
How it works

Name a song. Get the patch.

The agent runs an agentic loop over the MCP servers — fetching audio, analyzing it, predicting parameters, and dialing them into your synth.

1 · Fetch & isolate

You name a song; the agent fetches the audio, separates stems, and isolates the keyboard parts.

2 · Identify the engine

It profiles the spectral characteristics to spot the sound engine — subtractive, FM, organ, or sample-based.

3 · Predict parameters

Synth parameters are predicted via ML-based inverse synthesis or manual spectral analysis.

4 · Apply over MIDI

It applies the settings to your connected MIDI keyboard through keyboards-mcp.

Stateless by design

The server holds no state — conversation history lives in the client REPL.

Orchestrates the stack

Drives keyboards-mcp and audio-analysis-mcp as MCP servers over stdio.

Architecture

One agent, two tool servers

A stateless HTTP server runs the ToolLoopAgent against an AI Gateway, spawning both MCP servers over stdio.

REPL
HTTP client
— POST /chat →
HTTP Server
stateless
ToolLoopAgent
AI Gateway · LLM
keyboards-mcp
Node · stdio
·
audio-analysis-mcp
Python · stdio

The ToolLoopAgent handles the agentic loop — tool calls, results, and multi-step reasoning — while the MCP servers provide keyboard control and audio analysis. Bring it up with npm run dev:full and run npm run repl.

Where it fits

The brain of the pipeline

The agent ties analysis and MIDI control together into one end-to-end loop.

AudioAnalysisAgentMIDISynth