Skip to main content

Endpoint

POST /api/v1/music/midi
Synchronous. Returns MIDI data directly in the response. Analyzes a music clip and returns instrument note data in a structured format compatible with MIDI. Useful for music production workflows, score notation, or interactive music tools.

Request body

FieldTypeRequiredDescription
clip_idstringYesClip ID to analyze. Obtain from Upload Audio (data.clipId) or a completed generation task (results[].id).
stem_clip_idstringNoOptional stem clip ID (from Stem Separation) for more accurate instrument isolation.

Response

{
  "code": 0,
  "message": "ok",
  "request_id": "req-1710000000000",
  "data": {
    "state": "complete",
    "instruments": {
      "piano": [ ... ],
      "bass": [ ... ]
    }
  }
}
FieldTypeDescription
statestringProcessing state
instrumentsobjectMap of instrument name → note array

Example

curl -X POST https://api.example.com/api/v1/music/midi \
  -H "Authorization: Bearer sk-mm-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "clip_id": "abc123def456"
  }'

Workflow tip

For best results, run Stem Separation first and pass the returned job ID as stem_clip_id:
# Step 1: separate stems
POST /api/v1/music/stem  stem.id = "stem-xyz"

# Step 2: export MIDI with stem context
POST /api/v1/music/midi  { "clip_id": "abc123", "stem_clip_id": "stem-xyz" }