Mozart API
Audio to MIDI API
The Mozart audio to MIDI API is a REST API that turns an MP3 or WAV file into a MIDI file of its notes. Upload the audio, send it to POST /v1/midi, and download the .mid file when the job finishes. Each conversion costs 16 credits a track, whatever the length of the audio.
Use this audio to MIDI converter API with a file you upload, or with a song you made with the Mozart API.
Need it online, without code? Use the audio to MIDI converter on the Mozart site.
The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits.
Updated November 27, 2026
On this page
The audio to MIDI API at a glance
| Item | Value |
|---|---|
| Endpoint | POST https://api.mozartai.com/v1/midi, a REST API over HTTPS and JSON |
| Input | An MP3 or WAV upload (upload_id), sent from a local file up to 500 MiB or from a public https source_url, or a Mozart song_id |
| Output | One .mid file (audio/midi) per job, from an expiring download link |
| Delivery | Async job (HTTP 202), collected with POST /v1/jobs/wait, GET /v1/jobs/{job_id} or a signed webhook |
| Cost | 16 credits a track, whatever the length of the audio. Uploads and estimates are free, and failed jobs refund their credits |
| Auth | Authorization: Bearer API key |
| Access | REST API |
| Code samples | Python, curl and JavaScript (Node) |
What you get back: a .mid file
- One
.midfile per job, withcontent_typeaudio/midi, linked from the job'soutputs. The link expires, so save the file. - Estimated notes from uploaded or Mozart audio. MP3 to MIDI is transcription, so review the
.midfile in your DAW before you rely on it. - Send one part if you can. If you have the part you want (a bassline, a vocal, a piano take) as its own file, send that. For a song made with Mozart, you can split it into stems first with the stem separation API.
How the audio to MIDI API works
It is a plain REST API: requests and responses are JSON over HTTPS, with no SDK required. Send your key as Authorization: Bearer $MOZART_API_KEY. Create a key on the Developer page of the Mozart web app.
- Upload the audio (free). Call
POST /v1/uploadswithpurpose: "midi". For a local file, send itsfilename,content_typeandsize_bytes, and you get back anupload_url, anupload_methodandupload_headersto send the bytes with. For a file already online, send a public httpssource_urlinstead and Mozart fetches it. Use the upload once itsstatusisready. - Start the MIDI job. Call
POST /v1/midiwith theupload_id, or with asong_idfor a song made with Mozart, and anIdempotency-Keyheader. It returns HTTP 202 and a job. - Collect the MIDI file. Wait with
POST /v1/jobs/wait, readGET /v1/jobs/{job_id}, or take a webhook. When the job hassucceeded, download the file from themidientry inoutputs.
Python: convert a local MP3 or WAV to MIDI
This is the full MP3 to MIDI API flow in Python, and a WAV works the same way. Plain HTTPS and JSON with requests. No SDK needed.
import os
import time
import uuid
import requests
API = "https://api.mozartai.com"
H = {
"Authorization": f"Bearer {os.environ['MOZART_API_KEY']}",
"Content-Type": "application/json",
}
PATH = "bassline.wav" # or an .mp3, with content_type "audio/mpeg"
# 1. Upload the audio (free).
r = requests.post(
f"{API}/v1/uploads",
headers={**H, "Idempotency-Key": str(uuid.uuid4())},
json={
"purpose": "midi",
"filename": os.path.basename(PATH),
"content_type": "audio/wav",
"size_bytes": os.path.getsize(PATH),
},
)
r.raise_for_status()
up = r.json()
with open(PATH, "rb") as f:
sent = requests.request(
up["upload_method"], up["upload_url"],
headers=up["upload_headers"], data=f,
)
sent.raise_for_status()
while up["status"] not in ("ready", "failed"):
time.sleep(2)
r = requests.get(f"{API}/v1/uploads/{up['id']}", headers=H)
r.raise_for_status()
up = r.json()
if up["status"] == "failed":
raise RuntimeError("Mozart could not read the file")
# 2. Start the MIDI job (16 credits). The key makes retries safe.
r = requests.post(
f"{API}/v1/midi",
headers={**H, "Idempotency-Key": str(uuid.uuid4())},
json={"upload_id": up["id"]},
)
r.raise_for_status()
job = r.json()["job"]
# 3. Wait for the job, then download the MIDI file.
while job["status"] not in ("succeeded", "failed", "cancelled"):
r = requests.post(f"{API}/v1/jobs/wait", headers=H,
json={"job_ids": [job["id"]], "wait_seconds": 25})
r.raise_for_status()
job = r.json()["jobs"][0]
if job["status"] in ("failed", "cancelled"):
msg = (job.get("error") or {}).get("message") or job["status"]
raise RuntimeError(msg)
midi = next(o for o in job["outputs"] if o["type"] == "midi")
dl = requests.get(midi["url"])
dl.raise_for_status()
with open("bassline.mid", "wb") as f:
f.write(dl.content)For a file that is already online, pass json={"purpose": "midi", "source_url": "https://example.com/bassline.wav"} to POST /v1/uploads, skip the with open(PATH, "rb") block, and keep the status loop.
curl: convert an MP3 or WAV URL to MIDI
Create an upload from a public https URL, wait until its status is ready on GET /v1/uploads/{upload_id}, then start the MIDI job with its upload_id. For a song made with Mozart, skip the upload and send song_id instead.
# 1. Fetch an MP3 or WAV from a public https URL (free).
curl https://api.mozartai.com/v1/uploads \
-H "Authorization: Bearer $MOZART_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "purpose": "midi", "source_url": "https://example.com/bassline.mp3" }'
# 2. Once GET /v1/uploads/6e2f4a91-8c3b-4d75-b0e6-2a9d1f7c5b38 returns status "ready", start the MIDI job.
curl https://api.mozartai.com/v1/midi \
-H "Authorization: Bearer $MOZART_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "upload_id": "6e2f4a91-8c3b-4d75-b0e6-2a9d1f7c5b38" }'
# 3. Poll the job until status is "succeeded", then download outputs[].url.
curl https://api.mozartai.com/v1/jobs/7803ecff-3a51-4c2e-9d84-1b6f0e2a7c93 \
-H "Authorization: Bearer $MOZART_API_KEY"JavaScript: convert an MP3 or WAV URL to MIDI
Node 18 or later, saved as an .mjs file. No SDK needed.
import { randomUUID } from "node:crypto";
import { writeFile } from "node:fs/promises";
const API = "https://api.mozartai.com";
const H = {
Authorization: `Bearer ${process.env.MOZART_API_KEY}`,
"Content-Type": "application/json",
};
async function call(method, path, body) {
const r = await fetch(`${API}${path}`, {
method,
headers: body ? { ...H, "Idempotency-Key": randomUUID() } : H,
body: body ? JSON.stringify(body) : undefined,
});
if (r.status >= 400) throw new Error(await r.text());
return r.json();
}
// 1. Fetch a WAV or MP3 from a public https URL (free).
let up = await call("POST", "/v1/uploads", {
purpose: "midi",
source_url: "https://example.com/bassline.wav",
});
while (["ready", "failed"].includes(up.status) === false) {
await new Promise((done) => setTimeout(done, 2000));
up = await call("GET", `/v1/uploads/${up.id}`);
}
if (up.status === "failed") throw new Error("Mozart could not read the file");
// 2. Start the MIDI job (16 credits).
let { job } = await call("POST", "/v1/midi", { upload_id: up.id });
// 3. Wait for the job, then download the MIDI file.
while (["succeeded", "failed", "cancelled"].includes(job.status) === false) {
const res = await call("POST", "/v1/jobs/wait", {
job_ids: [job.id],
wait_seconds: 25,
});
job = res.jobs[0];
}
if (job.status === "failed" || job.status === "cancelled") {
throw new Error(job.error?.message ?? job.status);
}
const midi = job.outputs.find((o) => o.type === "midi");
const dl = await fetch(midi.url);
if (dl.status >= 400) throw new Error(`Download failed: ${dl.status}`);
await writeFile("bassline.mid", Buffer.from(await dl.arrayBuffer()));For a song made with Mozart, skip step 1 and pass { song_id: "5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14" } to POST /v1/midi.
POST /v1/midi request and response
POST /v1/uploads body (for MP3 or WAV files)
Send a public https source_url, or send filename, content_type and size_bytes to upload a local file.
| Field | Type | Required | What it is |
|---|---|---|---|
purpose | string | yes | Set to "midi". |
source_url | string | for URL uploads | A public https link to an MP3 or WAV file. |
filename | string | for local uploads | The file name, for example bassline.wav. |
content_type | string | for local uploads | audio/mpeg for MP3 or audio/wav for WAV. |
size_bytes | integer | for local uploads | File size in bytes, up to 500 MiB. |
POST /v1/midi body
Send exactly one of song_id or upload_id. Both or neither returns PUBLIC_API_INPUT_INVALID.
| Field | Type | Required | What it is |
|---|---|---|---|
song_id | string | one of the two | A song made with Mozart, for example 5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14. |
upload_id | string | one of the two | A ready upload from POST /v1/uploads with purpose: "midi", for example 6e2f4a91-8c3b-4d75-b0e6-2a9d1f7c5b38. |
dry_run | boolean | no, default false | true returns the cost estimate and starts nothing. |
Header Idempotency-Key is required.
Response: HTTP 202 (abridged)
{
"dry_run": false,
"estimate": { "credits_required": 16, "balance": 500, "balance_after": 484 },
"job": {
"id": "7803ecff-3a51-4c2e-9d84-1b6f0e2a7c93",
"object": "job",
"kind": "midi",
"status": "queued",
"outputs": [],
"credits_charged": null,
"credits_refunded": false,
"error": null,
"poll_after_seconds": 5
},
"balance_after": 484
}A finished job (abridged)
The download link expires at url_expires_at.
{
"id": "7803ecff-3a51-4c2e-9d84-1b6f0e2a7c93",
"object": "job",
"kind": "midi",
"status": "succeeded",
"outputs": [
{
"type": "midi",
"url": "https://...",
"url_expires_at": "2026-11-27T13:00:00Z",
"content_type": "audio/midi"
}
],
"credits_charged": 16,
"credits_refunded": false,
"error": null
}Webhooks, retries and errors
- Webhooks: signed
job.succeeded,job.failedandjob.cancelledevents, so you need no polling loop. - Long-polling:
POST /v1/jobs/waittakes 1 to 20job_idsand holds for up to 25 seconds. - Safe retries: a retry with the same
Idempotency-Keynever charges twice: a key is bound to its first request for 90 days; its response is replayed for 24 hours; use a new key for a new request. - Errors: a failed job carries
errorwithcode,messageandnext_step. Upload errors includePUBLIC_API_URL_NOT_ALLOWEDandPUBLIC_API_UPLOAD_TOO_LARGE. See API error codes.
Audio to MIDI API pricing
An audio to MIDI conversion costs 16 credits a track, whatever the length of the audio. Top-up credits cost $0.008 each, and monthly API plans cost less per credit. The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits.
- Uploads, cost estimates (
POST /v1/estimates, ordry_run: true), reads and job status never use credits. - With a test key,
POST /v1/midireturns the cost estimate and runs no conversion, so you can wire up your integration for free. - Failed jobs refund their credits.
- Credits come from your API plan or top-ups. One balance pays for songs, covers, stems, MIDI and mastering.
See API pricing for credit prices by plan.
Convert a Mozart song to MIDI
The same API key makes songs, splits stems and converts audio to MIDI.
POST /v1/songsmakes songs with vocals, lyrics and cover art, from $0.071 a song, 2 songs per request.POST /v1/midiwith thesong_idgives you the notes of the whole song, with no upload step.POST /v1/songs/{song_id}/stemssplits a song into parts. See the stem separation API.
MIDI from a song_id covers the whole song. If your app already makes songs with Mozart, MIDI is one more call:
curl https://api.mozartai.com/v1/midi \
-H "Authorization: Bearer $MOZART_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{ "song_id": "5d8e5a03-2c1f-4b7e-9a61-0f3d2c8b7e14" }'Rate limits and file size
| Limit | Value |
|---|---|
| Write requests | 60 a minute per key or connected app |
| Default daily credit limit of a new key | 3,750 credits on Starter, 6,250 on Build, 25,000 on Scale, 75,000 on Growth, and 2,000 with no API plan or for a test key |
| Uploaded file size | 500 MiB |
Each account also has a daily cap on audio to MIDI conversions and a cap on jobs running at once, set by plan. Requests over a limit are refused, and the error says when to try again (retry_after_seconds). Full table: API rate limits.
The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits.
Audio to MIDI converter API or Basic Pitch
Converting audio to MIDI is music transcription, not a format change, so an audio to MIDI API is a music transcription API. An audio file holds sound rather than note data, so any audio to MIDI converter API, hosted or open source, has to estimate the notes. No transcriber is exact.
Audio to MIDI AI tools, open-source and hosted alike, use a trained model to estimate the notes. Basic Pitch, for example, is a lightweight neural network.
Spotify's Basic Pitch is a free, Apache-2.0 open-source library. You install it with pip install basic-pitch, or from npm through its sibling repo basic-pitch-ts. It is polyphonic, instrument-agnostic and detects pitch bends, and its README says it works best on one instrument at a time. You run the model yourself; its README links a demo website but describes no hosted API.
| Compare | Mozart audio to MIDI API | Spotify Basic Pitch |
|---|---|---|
| What it is | Hosted REST API | Open-source library (Apache-2.0) that you run yourself |
| Setup | HTTPS and JSON with an API key, no SDK | pip install basic-pitch, or basic-pitch-ts from npm |
| Cost | 16 credits a track | Free library, run on your own machines |
| Jobs | Async jobs, webhooks, long-polling and safe retries | You build your own queue and retries |
| Where the audio goes | Uploaded to Mozart, or a Mozart song_id | Stays on your own network |
Basic Pitch fits when you are happy to run the model on your own machines, you want no per-job cost, or the audio must stay on your network.
A hosted API fits when you would rather not host or update a model, or you want jobs, webhooks and safe retries handled for you. Mozart also fits if you already make songs or stems with it.
Hosted audio to MIDI APIs compared
Several companies run hosted audio to MIDI APIs. The table lists each one's route as its own page describes it, with the date we read it. Formats, output layout and prices differ and change, so check each provider's docs before you choose.
| API | Route | Output | Source | Read |
|---|---|---|---|---|
| Mozart | POST https://api.mozartai.com/v1/midi (async job) | One .mid file per job | This page | |
| MusicGPT | POST /api/public/v1/audio_to_midi | MIDI | docs.musicgpt.com | 27 Nov 2026 |
| AI-MIDI | POST https://api.ai-midi.com/v1/convert | MIDI | ai-midi.com/api | 27 Nov 2026 |
| MusicToMIDI | POST /v1/files, then POST /v1/jobs on https://api.musictomidi.com (async job) | MIDI | musictomidi.com/developers | 27 Nov 2026 |
| Mirelo Audio-to-MIDI Pro API | Sync endpoint and async jobs (paths not on the announcement page) | One MIDI track per detected instrument, plus MusicXML | mirelo.ai blog | 27 Nov 2026 |
| Klangio Transcription API | Transcription jobs (paths in its OpenAPI spec) | MIDI, MusicXML, PDF or GP5 | api-docs.klang.io | 27 Nov 2026 |
| Tencent Smart Music, Vocal To Midi | POST https://api.mediax.tencent.com/job with action: "CreateJob" and a vocalMidi descriptor | MIDI or JSON of the vocal line | multimedia.tencent.com | 27 Nov 2026 |
| Audial | REST API, Python SDK and MCP | MIDI | audialmusic.ai | 27 Nov 2026 |
Audio to MIDI API FAQ
Is there an API to convert audio to MIDI?
Yes. Send audio to POST https://api.mozartai.com/v1/midi, with an upload or a song_id, and Mozart returns a job. When it finishes, the job's outputs hold a link to a .mid file.
Is there an MP3 to MIDI API or a WAV to MIDI API?
Yes. POST /v1/midi works as an MP3 to MIDI API and a WAV to MIDI API. Upload the MP3 or WAV with POST /v1/uploads and purpose: "midi", either by sending the bytes to the returned upload_url or from a public https link. When the upload is ready, pass its upload_id to POST /v1/midi.
What is the best audio to MIDI converter API?
It depends on how you work. Pick a hosted audio to MIDI converter API if you want no model to run, async jobs and webhooks. Pick an open-source library such as Basic Pitch if the audio must stay on your machines. Mozart's API adds flat pricing per track, webhooks, and MIDI straight from songs made with Mozart. Other hosted audio to MIDI APIs include MusicGPT, Mirelo, AI-MIDI, MusicToMIDI, Klangio, Tencent's Vocal To Midi, Yamaha's Music Connect API and Audial. The table above lists each one's route; compare their formats, output layout and pricing in each one's docs.
Which audio formats does the audio to MIDI API accept?
Send MP3 (audio/mpeg) or WAV (audio/wav) files up to 500 MiB per file. Upload a local file or pass a public https source_url to POST /v1/uploads with purpose: "midi", then send the upload_id to POST /v1/midi.
Does the audio to MIDI API return one MIDI file or several?
One. Each POST /v1/midi job returns one .mid file (audio/midi), linked from the midi entry in the job's outputs. The link expires, so save the file. To get the notes of one part, send that part as its own MP3 or WAV.
Can the audio to MIDI API transcribe a full song with several instruments?
You can send a full mix, and you get back one .mid file. If you have the part you want as its own file, send that instead. For a song made with Mozart, split it first with the stem separation API; stem separation works on songs made with Mozart, not on uploaded files.
Can I convert a vocal or a hummed melody to MIDI?
Send the vocal take as its own MP3 or WAV, the same way you send any other part, and you get back one .mid file. Like any transcription, the notes are estimates, so check them in your DAW before you rely on them.
How accurate is audio to MIDI conversion?
It depends on the recording. Audio holds sound, not note data, so every audio to MIDI converter estimates the notes, and no transcriber is exact. If you have the part you want as its own file, send that. The .mid file is ordinary MIDI, so you can check and correct the notes in your DAW.
How much does an audio to MIDI API cost?
On Mozart, 16 credits a track, whatever the length of the audio. Top-up credits cost $0.008 each, and monthly plans cost less per credit. Estimates, uploads and job status are free, and failed jobs refund their credits. The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits. Plans and credit prices are on API pricing.
Is the conversion synchronous or async?
It is async. POST /v1/midi returns HTTP 202 with a job. Collect the result with POST /v1/jobs/wait (up to 25 seconds per call), GET /v1/jobs/{job_id}, or a job.succeeded webhook.
How long does audio to MIDI conversion take?
The conversion runs as an async job, so your code never blocks on it. A newly queued MIDI job tells you to check back after 5 seconds (poll_after_seconds), and POST /v1/jobs/wait holds for up to 25 seconds per call.
Is it a hosted online API, or do I install a library?
It is online. The API runs at https://api.mozartai.com, so there is no model or library to install, only HTTPS calls with your API key. To convert a file in your browser without code, use the audio to MIDI converter.
Can I use the audio to MIDI API from Python?
Yes. It is plain HTTPS and JSON, so requests is enough, with no SDK. The Python example on this page uploads a local file, starts the job and downloads the .mid file.
Is there a free audio to MIDI API?
Not from Mozart: each MIDI job uses credits. Uploads, estimates and job status are free. A test key returns the cost estimate without running a conversion, so you can wire up your integration before you spend. If you want a free library to run yourself, Spotify's Basic Pitch is open source on GitHub (github.com/spotify/basic-pitch), with a TypeScript version in basic-pitch-ts.
Does Basic Pitch have an API?
Basic Pitch is an open-source library, not a hosted API. Its README links a demo website but describes no hosted API, so you install it with pip install basic-pitch, or basic-pitch-ts from npm, and run the model yourself. If you want a hosted endpoint with jobs and webhooks, use POST /v1/midi.
Is there an audio to MIDI API on GitHub?
The audio to MIDI projects on GitHub, such as Spotify's Basic Pitch (github.com/spotify/basic-pitch) and basic-pitch-ts, are libraries you install and run yourself. A hosted API such as POST /v1/midi runs the conversion for you, so there is no repo to clone and no model to host.
Is there an AI audio to MIDI API?
Yes, if you mean a hosted API that estimates the notes from MP3 or WAV files. Send audio to POST /v1/midi over REST and download the .mid file from the finished job, with no local model or SDK to install.
Is there an audio to MIDI plugin?
This is an API, not a DAW plugin. Download the .mid file from the job outputs and drag it into any DAW. To convert a file without code, use the audio to MIDI converter.
Related pages
Stem separation API
Split a song into vocals, drums, bass and other.
Read the guideMastering API
Bring a generated song up to streaming loudness.
Read the guide
Turn audio into MIDI from your code
The REST API needs an API plan (Starter, Build, Scale or Growth), from $20 a month, or prepaid API credits, and spends API credits. See API pricing.