pitch-mcp
MCP server for real-time pitch detection and score alignment. Listens to a singer via microphone and reports their current position in a score and whether they are singing in tune.
What it does
Covers three goals:
- Goal 4 — Show the current measure/beat position while singing
- Goal 5 — Report pitch accuracy (too high / too low / on pitch)
- Goal 6 — Identify where in the score a singer is based on a hummed or sung phrase
Supports both offline analysis of pre-recorded audio and real-time microphone input.
Tools
| Tool | Description |
|---|---|
analyze_recording |
Offline: analyse a WAV file against a reference MusicXML score |
load_score |
Load a MusicXML score into a named session; returns a session_id |
start_monitoring |
Open the microphone and begin real-time pitch detection |
get_current_position |
Poll the current score position and pitch accuracy |
stop_monitoring |
Stop the microphone and return a session summary |
list_capabilities |
Return server metadata: pitch backend, microphone availability |
health_check |
Check that runtime dependencies (librosa, sounddevice/portaudio) are available |
Installation
cd pitch-mcp
uv sync
For real-time monitoring (start_monitoring), PortAudio is required:
# Ubuntu / Debian
sudo apt install libportaudio2
Quick install: on Ubuntu/Debian/Linux Mint, bash install.sh handles uv and the optional
libportaudio2 install for you — see SETUP.md for the full non-technical walkthrough.
Ready-made client configs (Claude Desktop, Cursor, Windsurf, Continue, Zed) are in
examples/. If something goes wrong, check TROUBLESHOOTING.md.
Running
uv run pitch-mcp
Configuration
| Variable | Default | Description |
|---|---|---|
PITCH_BACKEND |
librosa |
Pitch detection algorithm: librosa or crepe |
crepe requires a manual TensorFlow install (~500 MB) and downloads ~50 MB of model weights on first use. The default librosa backend (pYIN algorithm) works well for singing voice with no extra setup.
Usage examples
// Offline analysis of a recording
{
"tool": "analyze_recording",
"arguments": {
"wav_path": "/path/to/recording.wav",
"musicxml_path": "/path/to/score.mxl",
"part_name": "Soprano"
}
}
// Real-time session
{"tool": "load_score", "arguments": {"musicxml_path": "/path/to/score.mxl", "part_name": "Alto"}}
// → returns {"session_id": "abc123"}
{"tool": "start_monitoring", "arguments": {"session_id": "abc123"}}
{"tool": "get_current_position", "arguments": {"session_id": "abc123"}}
// → returns measure, beat, expected pitch, detected pitch, accuracy
{"tool": "stop_monitoring", "arguments": {"session_id": "abc123"}}
Audio must be 16-bit PCM WAV. MP3 and FLAC are not supported.
Testing
# Unit tests (no microphone or audio required)
VIRTUAL_ENV= .venv/bin/pytest tests/ -v
# Integration tests (offline analysis against a committed fixture pair)
VIRTUAL_ENV= .venv/bin/pytest tests/ -v -m integration
# Manual tests (real microphone required — skip in CI)
VIRTUAL_ENV= .venv/bin/pytest tests/ -v -m manual
112 of the 118 total tests are unit tests, run against mocks and synthetic (in-memory) WAV data —
none require real audio hardware or pre-recorded fixtures. The other 6 are marked integration
(4 — offline analysis against the committed tests/fixtures/ pair) or manual (2 — full
real-microphone session lifecycle) and are excluded from a plain pytest tests/ run by
tests/conftest.py; select them explicitly with -m integration / -m manual.
Dependencies
- librosa — pYIN pitch detection (primary backend, pure Python)
- music21 — score parsing and pitch calculations
- sounddevice — real-time microphone input
- numpy, scipy — numerics
- mcp — MCP protocol
System requirements
- Python 3.12+
libportaudio2— required for real-time microphone input (start_monitoring)- No system libraries required for offline analysis
Phase status
| Phase | Status |
|---|---|
| Phase A — offline analysis | Complete. DTW-based alignment (dtaidistance); 112 unit tests plus 4 -m integration tests against a committed fixture pair (tests/fixtures/) |
| Phase B — real-time monitoring | Complete. Position tracking is audio-driven (matches detected pitch, not just elapsed time); tempo_bpm override supported. Covered by unit tests with mocked sounddevice; full-lifecycle -m manual tests exist for real-microphone verification but require real hardware to run |
Metadata
Release files for pitch-mcp 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pitch_mcp-0.3.1.tar.gz | 606.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pitch_mcp-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 626.9 kB
Release files / pitch_mcp-0.3.1.tar.gz
| Download URL | pitch_mcp-0.3.1.tar.gz |
|---|---|
| Size | 606.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
18722d8ca084d62699b74d6853c905f7dc4be29320718b6df2d80cba6d5fd414
|
|
BLAKE2b-256 checksum How to use checksums |
fcf99ff71c0b4593b027223104f91ec745a714c6e33b275f1c324b0c4a2abf23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency logRelease files / pitch_mcp-0.3.1-py3-none-any.whl
| Download URL | pitch_mcp-0.3.1-py3-none-any.whl |
|---|---|
| Size | 20.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6eca197e37b8f18a47802285c54267ab0533ad29b29aa86aaeb275739943e665
|
|
BLAKE2b-256 checksum How to use checksums |
59ec3bc983f532415c0892bd219295be59ba1dadec0656d73639869c9b8fa8df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 26, 2026.
Transparency log