---
title: "Convert Audio to MIDI"
method: POST
path: "/v1/audio_to_midi"
---

# Convert Audio to MIDI

`POST /v1/audio_to_midi`

## Request

- Base URL: `https://api.musicgpt.com/api/public`
- URL: `https://api.musicgpt.com/api/public/v1/audio_to_midi`
- Auth: API key in header `Authorization`

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.

## Request body `multipart/form-data`

- union
  - object
    - `audio_url` string, required: Input audio URL (supported format: YouTube URL).
    - `audio_file` string, binary: Audio file to upload and process directly.
    - `sonify_midi` boolean: If true, generates a .wav file that sonifies the MIDI output.
    - `save_note_events` boolean: If true, saves predicted note events as a CSV file.
    - `webhook_url` string: Callback URL to receive conversion results.
  - object
    - `audio_url` string: Input audio URL (supported format: YouTube URL).
    - `audio_file` string, binary, required: Audio file to upload and process directly.
    - `sonify_midi` boolean: If true, generates a .wav file that sonifies the MIDI output.
    - `save_note_events` boolean: If true, saves predicted note events as a CSV file.
    - `webhook_url` string: Callback URL to receive conversion results.

## Response `200`

MIDI conversion task initiated successfully

- object
  - `success` boolean
  - `task_id` string
  - `message` string

## Other responses

- `400`: Invalid request parameters
- `500`: Internal server error

---

[API](https://skmtc.dev/musicgpt/apis/musicgpt-api.md) - [All operations](https://skmtc.dev/musicgpt/apis/musicgpt-api/llms.txt) - [OpenAPI document](https://skmtc.dev/musicgpt/apis/musicgpt-api/revisions/6753dccf4c5d?raw)
