Audio to MIDI

Can ChatGPT make a MIDI file?

ChatGPT can't make a MIDI file on its own, but it can write code or text notation that becomes one. Here is how that works, and where it falls short.

On this page
  1. Short answer
  2. Method 1: ask for a Python script
  3. Method 2: text notation
  4. What to put in the prompt
  5. What it can’t do
  6. Check the file in your DAW
  7. Common misconceptions

Short answer

Indirectly. ChatGPT can’t hand you a .mid file on its own. It can write code or text notation, and that becomes a MIDI file when you run the code or convert the notation. Some setups let it run code and offer the file for download. Others need you to run the script on your own computer. Either way, the notes come from your description. ChatGPT is not a reliable way to turn a recording into notes.

Method 1: ask for a Python script

Ask ChatGPT to write a Python script using a MIDI library such as mido, MIDIUtil or pretty_midi. Run the script on your computer, or in a tool that can run code, and you get a .mid file.

Here is a minimal example using mido. It writes one middle C (MIDI note 60) lasting one beat at 120 BPM:

import mido

mid = mido.MidiFile(ticks_per_beat=480)
track = mido.MidiTrack()
mid.tracks.append(track)

track.append(mido.MetaMessage('set_tempo', tempo=mido.bpm2tempo(120)))
track.append(mido.Message('note_on', note=60, velocity=100, time=0))
track.append(mido.Message('note_off', note=60, velocity=64, time=480))

mid.save('one_note.mid')

Install mido first with pip install mido. The file it writes can be imported into any DAW.

Method 2: text notation

If you ask for ABC notation, you get a short text description of a melody or chords. Free tools such as abc2midi and EasyABC turn ABC into a MIDI file. This route suits simple melodies and chord charts.

What to put in the prompt

Give ChatGPT the details a MIDI file needs:

  • Tempo, key and time signature.
  • The number of bars.
  • The instrument, and its General MIDI program number if you want a specific sound.
  • The notes, chords or style you want.
  • For drums, whether you want them on channel 10 with General MIDI drum notes (kick 36, snare 38, closed hi-hat 42).

What it can’t do

  • Transcribe audio. ChatGPT is not a reliable audio-to-MIDI tool. For that, use a dedicated converter, such as Melodyne or Spotify’s Basic Pitch. The pillar guide explains how to choose one.
  • Produce polished music. The output is usually basic, so expect to edit the rhythm, voicing and dynamics.
  • Promise the same features every time. What a chat assistant can do depends on your plan and model. Check yours.

Check the file in your DAW

Import the file into your DAW and assign an instrument. Check the bar lengths, the note lengths and the tempo track. If the file came from a script, see how to import MIDI in Studio One for one example of the import steps.

For drums, check that the part sits on channel 10 and that your drum instrument uses General MIDI notes. If it doesn’t, the kit will play the wrong sounds.

Common misconceptions

  • ChatGPT plays the music. It writes the file. The sound comes from the instrument you load in your DAW.
  • A .mid file contains instrument sounds. It holds note data only.
  • Text in a chat reply is a MIDI file. You need a binary .mid file, which has to be saved or generated by running the code.
  • The timing is always right. Check bar lengths and note durations.

The complete guide to audio to midi

How to Convert Audio to MIDI Accurately
Read the guide

Keep exploring

Guides from other topics

All topics →