Generate MIDI from Audio
Convert separated audio tracks into MIDI format with detailed note information for each instrument.
Documentation Index
Fetch the complete documentation index at: https://docs.sunoapi.org/llms.txt
Use this file to discover all available pages before exploring further.
Usage Guide
- Convert separated audio tracks into structured MIDI data containing pitch, timing, and velocity information
- Requires a completed vocal separation task ID (from the Vocal Removal API)
- Generates MIDI note data for multiple detected instruments including drums, bass, guitar, keyboards, and more
- Ideal for music transcription, notation, remixing, or educational analysis
- Best results on clean, well-separated audio tracks with clear instrument parts
Prerequisites
Parameter Reference
| Name | Type | Description |
|---|---|---|
taskId | string | Required. Task ID from a completed vocal separation |
callBackUrl | string | Required. URL to receive MIDI generation completion notifications |
audioId | string | Optional. Specifies which separated audio track to generate MIDI from. This audioId can be obtained from the originData array in the Get Vocal Separation Details endpoint response. Each item in originData contains an id field that can be used here. If not provided, MIDI will be generated from all separated tracks. |
Developer Notes
- The callback will contain detailed note data for each detected instrument
- Each note includes:
pitch(MIDI note number),start(seconds),end(seconds),velocity(0-1) - Not all instruments may be detected - depends on audio content
- Billing: Check current per-call credit costs at https://sunoapi.org/dashboard
Authorizations
🔑 API Authentication
All endpoints require authentication using Bearer Token.
Get API Key
- Visit the API Key Management Page to obtain your API Key
Usage
Add to request headers:
Authorization: Bearer YOUR_API_KEY⚠️ Note:
- Keep your API Key secure and do not share it with others
- If you suspect your API Key has been compromised, reset it immediately from the management page
Body
Task ID from a completed vocal separation. This should be the taskId returned from the Vocal & Instrument Stem Separation endpoint.
"5c79****be8e"
The URL to receive MIDI generation task completion updates. Required for all MIDI generation requests.
- System will POST task status and MIDI note data to this URL when generation completes
- Callback includes detailed note information for each detected instrument with pitch, timing, and velocity
- Your callback endpoint should accept POST requests with JSON payload containing MIDI data
- For detailed callback format and implementation guide, see MIDI Generation Callbacks
- Alternatively, use the Get MIDI Generation Details endpoint to poll task status
"https://example.callback"
Optional. Specifies which separated audio track to generate MIDI from. This audioId can be obtained from the originData array in the Get Vocal Separation Details endpoint response. Each item in originData contains an id field that can be used here. If not provided, MIDI will be generated from all separated tracks.
"8ca376e7-******-08aaf2c6dd27"
