Python
import requests
url = "https://api.wav.com/api/public/v1/audio_to_midi"
headers = {"Authorization": "<API_KEY>"}
payload = {
"sonify_midi": True,
"save_note_events": True,
"webhook_url": "https://your-webhook-url.com/callback"
}
# Option 1: audio_url
payload["audio_url"] = "<YOUR_AUDIO_URL>"
response = requests.post(url, headers=headers, data=payload)
# Option 2: File Upload
# with open("audio.wav", "rb") as f:
# files = {"audio_file": f}
# response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())curl --request POST \
--url https://api.wav.com/api/public/v1/audio_to_midi \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form audio_url=https://example.com/audio.mp3 \
--form 'audio_file=<string>' \
--form sonify_midi=true \
--form save_note_events=true \
--form webhook_url=https://your-webhook-url.com/callback \
--form 0.audio_file='@example-file' \
--form 1.audio_file='@example-file'const form = new FormData();
form.append('audio_url', 'https://example.com/audio.mp3');
form.append('audio_file', '<string>');
form.append('sonify_midi', 'true');
form.append('save_note_events', 'true');
form.append('webhook_url', 'https://your-webhook-url.com/callback');
form.append('0.audio_file', '{
"fileName": "example-file"
}');
form.append('1.audio_file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.wav.com/api/public/v1/audio_to_midi', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wav.com/api/public/v1/audio_to_midi",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wav.com/api/public/v1/audio_to_midi"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wav.com/api/public/v1/audio_to_midi")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wav.com/api/public/v1/audio_to_midi")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "cf34f4e0-3273-41e4-95e5-05dc745b9852",
"conversion_id": "0b0b59e5-4c71-49ec-8ca5-5cd05142d5ab",
"eta": 37,
"credit_estimate": 0.016,
"message": "Message published to queue",
"status": "IN_QUEUE"
}{
"success": false,
"error": "Missing or invalid audio_url"
}{
"success": false,
"error": "Error during MIDI conversion"
}Features
Audio to MIDI
Processes an audio file and converts it into a MIDI file. Optionally generates a sonified .wav and/or a CSV of note events. This request is handled asynchronously.
POST
/
v1
/
audio_to_midi
Python
import requests
url = "https://api.wav.com/api/public/v1/audio_to_midi"
headers = {"Authorization": "<API_KEY>"}
payload = {
"sonify_midi": True,
"save_note_events": True,
"webhook_url": "https://your-webhook-url.com/callback"
}
# Option 1: audio_url
payload["audio_url"] = "<YOUR_AUDIO_URL>"
response = requests.post(url, headers=headers, data=payload)
# Option 2: File Upload
# with open("audio.wav", "rb") as f:
# files = {"audio_file": f}
# response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())curl --request POST \
--url https://api.wav.com/api/public/v1/audio_to_midi \
--header 'Authorization: <api-key>' \
--header 'Content-Type: multipart/form-data' \
--form audio_url=https://example.com/audio.mp3 \
--form 'audio_file=<string>' \
--form sonify_midi=true \
--form save_note_events=true \
--form webhook_url=https://your-webhook-url.com/callback \
--form 0.audio_file='@example-file' \
--form 1.audio_file='@example-file'const form = new FormData();
form.append('audio_url', 'https://example.com/audio.mp3');
form.append('audio_file', '<string>');
form.append('sonify_midi', 'true');
form.append('save_note_events', 'true');
form.append('webhook_url', 'https://your-webhook-url.com/callback');
form.append('0.audio_file', '{
"fileName": "example-file"
}');
form.append('1.audio_file', '{
"fileName": "example-file"
}');
const options = {method: 'POST', headers: {Authorization: '<api-key>'}};
options.body = form;
fetch('https://api.wav.com/api/public/v1/audio_to_midi', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.wav.com/api/public/v1/audio_to_midi",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: multipart/form-data; boundary=---011000010111000001101001"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.wav.com/api/public/v1/audio_to_midi"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.wav.com/api/public/v1/audio_to_midi")
.header("Authorization", "<api-key>")
.header("Content-Type", "multipart/form-data; boundary=---011000010111000001101001")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.wav.com/api/public/v1/audio_to_midi")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'multipart/form-data; boundary=---011000010111000001101001'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_url\"\r\n\r\nhttps://example.com/audio.mp3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"audio_file\"\r\n\r\n<string>\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"sonify_midi\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"save_note_events\"\r\n\r\ntrue\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"webhook_url\"\r\n\r\nhttps://your-webhook-url.com/callback\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"0.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"1.audio_file\"; filename=\"example-file\"\r\nContent-Type: application/octet-stream\r\n\r\n{\r\n \"fileName\": \"example-file\"\r\n}\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "cf34f4e0-3273-41e4-95e5-05dc745b9852",
"conversion_id": "0b0b59e5-4c71-49ec-8ca5-5cd05142d5ab",
"eta": 37,
"credit_estimate": 0.016,
"message": "Message published to queue",
"status": "IN_QUEUE"
}{
"success": false,
"error": "Missing or invalid audio_url"
}{
"success": false,
"error": "Error during MIDI conversion"
}Convert an audio file into a MIDI file using AI-driven audio analysis and transcription.
The Audio to MIDI endpoint processes audio files to generate MIDI sequences. It can optionally create a sonified
This is the primary endpoint for initiating audio-to-MIDI conversion tasks.
.wav file of the MIDI output and export note events into a .csv file for further analysis or editing.
Ideal for music production, remixing, and advanced audio content creation.
Endpoint
POST /v1/audio_to_midi
Sample Output
Generated MIDI and optional outputs from a sample audio file: Download MIDI(.mid) Download Sonified MIDI(.wav)Try it Yourself
Visit the Audio to MIDI Endpoint Explorer to test it live. Upload an audio file, and get back the MIDI version!🛠️ Request Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
audio_file | File | Optional | Upload the audio file directly. Required if audio_url is not provided. | |
audio_url | String | Optional | URL to the audio file. | |
sonify_midi | Boolean | Optional | true | If true, generates a .wav file that plays the MIDI output. |
save_note_events | Boolean | Optional | true | If true, saves predicted note events as a .csv file. |
webhook_url | String | Optional | "" | Callback URL for asynchronous result delivery. |
Note: Either audio_file or audio_url must be provided.
content-type: multipart/form-data
Sample Request
cURL
curl -X POST "https://api.wav.com/api/public/v1/audio_to_midi" \
-H "Authorization: <API_KEY>" \
-F "audio_url=<YOUR_AUDIO_URL>" \
-F "sonify_midi=true" \
-F "save_note_events=true" \
-F "webhook_url=https://your-webhook-url.com/callback"
Python
import requests
url = "https://api.wav.com/api/public/v1/audio_to_midi"
headers = {"Authorization": "<API_KEY>"}
payload = {
"sonify_midi": True,
"save_note_events": True,
"webhook_url": "https://your-webhook-url.com/callback"
}
# Option 1: audio_url
payload["audio_url"] = "<YOUR_AUDIO_URL>"
response = requests.post(url, headers=headers, data=payload)
# Option 2: File Upload
# with open("audio.wav", "rb") as f:
# files = {"audio_file": f}
# response = requests.post(url, headers=headers, data=payload, files=files)
print(response.json())
Sample Response
Success (200 OK)
{
"success": true,
"task_id": "cf34f4e0-3273-41e4-95e5-05dc745b9852",
"conversion_id": "0b0b59e5-4c71-49ec-8ca5-5cd05142d5ab",
"eta": 37,
"credit_estimate": 0.016,
"message": "Message published to queue",
"status": "IN_QUEUE"
}
Webhook Response
{
"success": true,
"conversion_type": "Audio To MIDI",
"task_id": "cf34f4e0-3273-41e4-95e5-05dc745b9852",
"conversion_id": "0b0b59e5-4c71-49ec-8ca5-5cd05142d5ab",
"midi_file_path": "",
"sonify_file_path": "",
"notes_file_path": "",
"message": "Audio To MIDI Completed",
}
Common Errors
- 400 Bad Request: Invalid
audio_pathor missing required parameters. - 404 Not Found: Provided audio file not found in S3.
- 422 Unprocessable Entity: Unsupported audio format.
- 500 Internal Server Error: An unexpected error occurred while processing.
Payload and Request Formation
Authorizations
Body
multipart/form-data
- Option 1
- Option 2
Input audio URL (supported format: YouTube URL).
Example:
"https://example.com/audio.mp3"
Audio file to upload and process directly.
If true, generates a .wav file that sonifies the MIDI output.
If true, saves predicted note events as a CSV file.
Callback URL to receive conversion results.
Example:
"https://your-webhook-url.com/callback"
⌘I

