Colab Notebook to convert chatGPT text to MIDI
Hey there!
Buckle up, because in this dazzling notebook we're about to morph text generated by ChatGPT into a jazzy MIDI melody. Isn't that just the bee's knees? For days on end, what a fabulous time to make music!
Comments (28)
Weird, when I try to run the text to chords prompt, GPT is returning a melody like in the first prompt: chords_pitch_duration_data = [ # Introduction with a drone on A and an A minor chord to set the mood ((45, 52, 57), 2), # A2, E3, A3 - Double whole note for an ambient drone ((0), 0.5), # Short silence for breath # A section - Evoking a sense of yearning with minor chords ((45, 48, 52), 1), # A2, C3, E3 - Whole note for an A minor chord ((0), 0.25), # Quarter note silence ((47, 50, 55), 1), # B2, D3, G3 - Whole note for a B diminished chord ((0), 0.25), # Quarter note silence ((43, 47, 50), 1.5), # G2, B2, D3 - Dotted whole note for a G major chord, adding a sense of resolution but still within a somber mood # B section - Deeper reflection with augmented and add chords for a more complex emotional texture ((48, 52, 55, 59), 1.22), # C3, E3, G3, B3 - C major 7th chord for a slightly brighter, yet still introspective feel ((0), 0.33), # Pause to reflect ((45, 49, 52, 57), 1), # A2, D3, E3, A3 - A sus4 chord, adding a sense of suspension and unresolved emotions # C section - Return to the A minor theme with variations ((45, 48, 52, 55), 2), # A2, C3, E3, G3 - A minor 7th chord for a mournful, yet complex texture ((0), 0.5), # Half note silence for contemplation ((45, 52, 57), 2), # A2, E3, A3 - Returning to the drone-like A minor chord for closure and reflection # Ending with a prolonged silence to let the emotion settle ((0), 2) # Double whole note silence ] There's nothing like the example in the cell: chords_pitch_duration_data = [ ((60, 63, 67), 0.5), ((62, 65, 69), 0.5), ((64, 67, 71), 0.5), ((66, 69, 73), 0.5), ((68, 71, 75), 0.5), ((70, 73, 77), 0.5), ((72, 75, 79), 0.5), ((74, 77, 81), 0.5), ((76, 79, 83), 0.5), ((78, 81, 85), 0.5), ((80, 83, 87), 0.5), ((82, 85, 89), 0.5), ] [("D4", "F4", "A4"), 0.25], [("C4", "E4", "G4"), 0.25], [(None), 0.5], [("D4"), 0.25], [("C4"), 0.25],[("B3"), 0.25], [("A3"), 0.5], [("G3"), 0.25],[(None), 0.5], [("A3", "C4", "E4"), 0.25], [("G3", "B3", "D4"), 0.25],[("F3", "A3", "C4"), 1], [("D3", "F3", "A3"), 0.25],[("E3", "G3", "B3"), 0.25],[("D3", "F3", "A3"), 1.5], [("G3", "B3", "D4"), 1],[(None), 1], [("D4"), 0.125], [("E4"), 0.125],[("F4"), 0.125], [("G4"), 0.125],[("A4"), 1],[("G4"), 1], [(None), 1]]
never mind, operator error lol
ModuleNotFoundError Traceback (most recent call last) in () 1 # @markdown ### Run this cell and th MIDI with the Drums will be in your download folder ----> 2 import mido 3 from mido import Message, MidiFile, MidiTrack 4 5 # Create a new MIDI file ModuleNotFoundError: No module named 'mido'
getting this error message on the midi drums
Hey I got this error on the drum generator: TypeError Traceback (most recent call last) in () 14 if isinstance(note[0], tuple): # If more than one note at the same time 15 for n in note[0]: ---> 16 track.append(Message('note_on', note=n, velocity=note[2], time=0)) 17 track.append(Message('note_off', note=n, velocity=note[2], time=int(note[1]*ticks_per_note))) 18 else: 3 frames /usr/local/lib/python3.10/dist-packages/mido/messages/checks.py in check_data_byte(value) 57 def check_data_byte(value): 58 if not isinstance(value, Integral): ---> 59 raise TypeError('data byte must be int') 60 elif not 0 <= value <= 127: 61 raise ValueError('data byte must be in range 0..127') TypeError: data byte must be int
Nevermind, your original chatgpt output worked fine, so I just showed it to gpt and asked it to follow the structure properly
Hey nobody i think Colab it is not working today :C
Hello. I'm still kind of lost. Where can I generate the midi file, after copying the GPT Chat code please.
I'm having issue saving the drums patterns to my local storage
NameError Traceback (most recent call last) in () 11 ticks_per_note = int(ticks_per_beat * 0.25) # Assuming tempo is 120 bpm, this is the number of ticks for a quarter note 12 ---> 13 for note in drum_pitch_duration_data: 14 if isinstance(note[0], tuple): # If more than one note at the same time 15 for n in note[0]: NameError: name 'drum_pitch_duration_data' is not defined
run: !pip install mido !pip install MIDIUtil
Im getting an error in Colab running the chord cells. It says missing import package: midiutil.MidiFile import MIDIFile
melody_pitch_duration_data = [ (60, 0.25), (62, 0.25), (63, 0.25), (65, 0.5), (65, 0.25), (63, 0.25), (62, 0.25), (60, 0.5), (58, 0.25), (60, 0.25), (62, 0.5), (62, 0.25), (60, 0.25), (58, 0.25), (60, 0.5), (60, 0.25), (58, 0.25), (57, 0.25), (55, 0.5), (55, 0.25), (57, 0.25), (58, 0.25), (60, 0.25), (58, 0.25), (57, 0.25), (55, 0.25), (53, 0.25), (52, 0.25), (55, 0.5), (55, 0.5), (53, 0.5), (53, 0.5) ]
i fix it, please reload the notebook using the link
Good day the melody converter gives error NameError: name 'parsed_input' is not defined
tell me the melody_pitch_duration_data you are using
To start working with music using ChatGPT, begin by dividing the task: copy/paste first only the drums, or melody, or chords, choose one. This will give you the parts corresponding to that category. Then, use this information in Google Colab with the corresponding cell (if it is drum, use the drum one), and it should download the MIDI file to your computer. You should use a Digital Audio Workstation (DAW) to handle the MIDI files and assign them to virtual instruments. In my case, I use Ableton Live, and what you see in the video is a screen capture of the MIDI track from Ableton Live.
Hello, my dear! My chat is only giving me a code related to the drum part... What am I doing wrong? In addition, how can I view and play the MIDIs the way you do in your videos? Thank you!!!
hey shae that is maybe becouse you are not using the "chords_pitch_duration_data variable" to your data. Be sure that you run a cell with chords_pitch_duration_data = [your data] and then run the cell that convert and download the MIDI
Hey bro, I don't think the Chords generator is working in Colab,, can you confirm on your end if it is working correctly? I have ran the first cell, then I input the chord pitch duration info in the "Chord" cell, then run that, but then the midi that downloads is just a default 4 chord progression that has no relation to the info you input
ok tell me if you have other error and if it is working fine, thanks
thanks!
google docs?
download the file and upload to google docs, then open with google colab
where are you running the code in your video?
that is in google colab Iron
What do we do after downloading it?
upload to drive a double click, it will run google colab
