> ## Documentation Index
> Fetch the complete documentation index at: https://docs.audiopod.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Convert audio to MIDI

> Turn a recording of a song, melody or instrument into per-instrument MIDI files plus one multitrack MIDI with the AudioPod Python or Node SDK.

**What you get:** a `.mid` file per transcribed part (bass, vocals, piano by default; guitar on request) and one multitrack `.mid` with every part, plus the detected tempo.

**Input:** a local file or a URL of a recording at least 6 seconds long. A full mix is fine: AudioPod separates the parts first.

## 1. Install and set your key

<CodeGroup>
  ```bash Python theme={null}
  pip install audiopod
  export AUDIOPOD_API_KEY="ap_..."
  ```

  ```bash Node theme={null}
  npm install audiopod
  export AUDIOPOD_API_KEY="ap_..."
  ```
</CodeGroup>

## 2. Convert

<CodeGroup>
  ```python Python theme={null}
  from audiopod import Client

  client = Client()

  # convert() waits for the job by default
  job = client.midi.convert(
      file="song.mp3",  # or url="https://example.com/song.mp3"
      stems=["bass", "vocals", "piano"],
  )

  print("multitrack:", job["merged_midi_url"])
  for part, link in (job.get("midi_urls") or {}).items():
      print(part, link)
  ```

  ```typescript Node theme={null}
  import AudioPod from "audiopod";

  const client = new AudioPod();

  // transcribe() submits the conversion and waits for it
  const job = await client.midi.transcribe({
    file: "./song.mp3", // or url: "https://example.com/song.mp3"
    stems: ["bass", "vocals", "piano"],
  });

  console.log("multitrack:", job.merged_midi_url);
  for (const [part, link] of Object.entries(job.midi_urls ?? {})) {
    console.log(part, link);
  }
  ```
</CodeGroup>

## Already separated the stems?

Transcribe a finished [stem separation](/quickstarts/stem-separation) job instead of separating again. It is billed at the lower add-on rate.

<CodeGroup>
  ```python Python theme={null}
  midi = client.midi.convert_from_stem_job(stem_job_id=stem_job["id"])  # waits by default
  ```

  ```typescript Node theme={null}
  const queued = await client.midi.convertFromStemJob(stemJob.id); // returns at once
  const midi = await client.midi.waitForCompletion(queued.id);
  ```
</CodeGroup>

## Know before you ship

* It is a starting-point transcription: expect to tidy note timing and lengths in your DAW. Dynamics are approximate.
* Drums are not transcribed. Requesting `drums` or `other` returns them in `skipped_stems`.
* Guitar is experimental and can over-detect notes on busy mixes, so it is off unless you ask for it.
* Dedicated piano and vocal engines need a Creator plan or above. See [pricing](https://audiopod.ai/pricing).

## From an AI agent

With the [AudioPod MCP server](/agents) connected (core or full): *"Turn the bass line in [https://example.com/song.mp3](https://example.com/song.mp3) into MIDI."* The agent calls `audio_to_midi` with `stems: ["bass"]`.

Full endpoint reference: [Audio to MIDI](/api-reference/audio-to-midi).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.