GPT-4 To MIDI
Text prompt to MIDI File using OpenAI's GPT-4. Now with polyphony and MIDI input!
Web interface available on HugginFace
Dependencies:
pip install openai midiutil mido
Usage:
Ask it in plain english to generate, including any musical details that you want.
Input:
python g2m.py -p "Full piece of melancholy music with multiple parts. Plan out the structure beforehand, including chords, parts (soprano, alto, tenor, bass), meter, etc." -c
[*] Making request to OpenAI API
[*] Parsing content
[*] Wrote the MIDI file.
Next prompt> Keep it Eb instead of E for the second note
...
Next prompt> Write a simple soprano melody in the high octave range that fits over this piece.
Output:
Input:
python g2m.py -p "Full piece by Mozart with multiple parts. Plan out the structure beforehand, including chords, parts (soprano, alto, tenor, bass), meter, etc. Over 400 notes total."
Output:
Input:
python g2m.py -p "twinkle twinkle little star" -c
[*] Parsing content
[*] Wrote the MIDI file.
Next prompt> Tranpose it to A minor
Output:
Full options:
-h, --help show this help message and exit
-p PROMPT, --prompt PROMPT
specify prompt to use (default: Jazz!)
-c, --chat send follow up messages to make revisions,
continuations, etc. (type 'exit' to quit)
-l LOAD, --load LOAD load a MIDI file to be appended to your prompt
-v, --verbose display GPT-4 output
-o OUTPUT, --output OUTPUT
specify output directory (default: current)
-a AUTH, --auth AUTH specify openai api key (edit this script file to set a
default)
Author: d3n7
Source Code: https://github.com/d3n7/GPT-4-To-MIDI