Generate MIDI from Audio
Transcribe polyphonic instrumental harmonies, chord progressions, basslines, and melodic vocal lines into standard multitrack MIDI (.mid) files. Seamlessly replace AI instruments with custom VST synthesizers, sample libraries, or export to sheet music notation.
MIDI Transcription Capabilities
Standard SMF Type 1Accurately identifies dense jazz chords, piano voicings, guitar strumming, and synth pads.
Captures dynamic keystroke velocities (1–127) preserving the expressive human feel of the original track.
Compatible with Ableton, FL Studio, Logic Pro, Sibelius, MuseScore, and Guitar Pro.
Workflow & Best Practices
- Recommended Pipeline: For optimal polyphonic accuracy, first separate your music into stems via Stem Separation, then submit the separation
task_idto transcribe individual stems. - Full-Song vs Single Stem: If
audio_idis omitted, all available audio stems within the task are transcribed into separate MIDI tracks. - Low Credit Cost: Consumes only 5 credits per MIDI transcription job.
Validation Rules & Constraints
Source Task Requirement
The task_id must reference an existing stem separation or music generation job that has completed rendering.
Asynchronous Webhook
Complex neural transcription takes several seconds. Configure callBackUrl to be notified with the generated MIDI download URLs.
Authentication & Headers
| Header | Requirement | Description |
|---|---|---|
| Authorization | required | Bearer YOUR_API_KEY Secret API key generated in your dashboard. |
| Content-Type | required | application/json Request body format. |
Request Body Parameters
4 fieldstask_idstringrequiredUnique identifier of the completed stem separation task or music generation task.
audio_idstringoptionalUnique identifier (UUID) of the specific audio stem track to transcribe into MIDI. When omitted, all stems are transcribed into separate MIDI tracks.
taskTypestringoptionalExplicit task routing identifier. Can be set to "generate_midi".
callBackUrlstringoptionalPublic HTTPS webhook URL to receive asynchronous completion notification containing the downloadable MIDI file links.
When Callbacks Are Sent
The SongMesh API automatically triggers an HTTP POST request to your designated callBackUrl under these events:
- MIDI transcription job queued in neural polyphonic pitch tracker
- Harmonic frequency peaks, onsets, note durations, and velocities recognized
- Standard .MID files compiled and uploaded to cloud CDN
- Webhook notification dispatched with direct MIDI download URLs (code: 200)
Webhook Payload Format
{
"code": 200,
"msg": "All generated successfully.",
"data": {
"task_id": "3b66882fde0a5d398bd269cab6d9542b",
"data": [
{
"id": "efb902e8-ade5-467d-b7d0-61fa5e057d51",
"stem_type_group_name": "Vocals",
"midi_url": "https://file.aiquickdraw.com/s/vocals_melody_transcription.mid",
"duration": 218.4,
"status": "complete"
},
{
"id": "f239d1a9-0480-4ae5-ac28-feb7a12553cb",
"stem_type_group_name": "Instrumental",
"midi_url": "https://file.aiquickdraw.com/s/instrumental_polyphonic_chords.mid",
"duration": 218.4,
"status": "complete"
}
]
}
}Callback Payload Fields
| Field | Type | Description |
|---|---|---|
code | integer | HTTP status code (200: Success, 400: Bad Request, 500: Server error). |
msg | string | Execution status message ("All generated successfully." or error details). |
data.task_id | string | Unique task identifier corresponding to the MIDI transcription task. |
data.data | array | Array of transcribed MIDI tracks containing stem_type_group_name, direct midi_url download link, duration, and status. |
Receiver Implementation Example
// Next.js App Router Webhook Receiver (/api/webhook/suno/route.ts)
import { NextRequest, NextResponse } from 'next/server';
export async function POST(req: NextRequest) {
const payload = await req.json();
const { code, msg, data } = payload;
if (code === 200 && Array.isArray(data?.data)) {
console.log(`MIDI generation task ${data.task_id} completed successfully!`);
data.data.forEach((track: any) => {
console.log(`Track: ${track.stem_type_group_name} (ID: ${track.id})`);
console.log(`MIDI Download URL: ${track.midi_url}`);
});
// Import .mid files into Ableton Live, Logic Pro, Cubase, or Sibelius/MuseScore notation
} else {
console.error(`MIDI generation failed (${code}): ${msg}`);
}
return NextResponse.json({ received: true });
}Webhook Security Recommendation
Always verify incoming webhook payloads on your server. Respond with a 200 OK immediately after parsing the payload to prevent redundant delivery retries from the webhook dispatcher.
curl -X POST "https://api.sunoapi.top/api/v1/createTask" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskType": "generate_midi",
"task_id": "3e63b4cc88d52611159371f6af5571e7",
"audio_id": "8ca376e7-5b62-49d9-bbd3-08aaf2c6dd27",
"callBackUrl": "https://api.yourdomain.com/webhook/suno"
}'{
"code": 200,
"msg": "success",
"data": {
"taskId": "task_midi_1740000000000_abc123"
}
}• Virtual Instruments: Load the generated .mid files into Kontakt, Serum, Omnisphere, or Spitfire Audio to replace generated acoustic sounds with ultra-high-end VST instruments.
• Remixing: Rearrange melodies, change key signatures, and adjust quantization notes effortlessly in your DAW piano roll.
• Pricing: 5 credits per MIDI generation job.
Ready to extract multitrack MIDI note data?
Generate your API secret key and export polyphonic MIDI files for studio production in seconds.