I’ve been using ChatGPT to write this code (I have no idea how to code in python) to convert a midi file into a note format and the duration of the note. The note name part is working fine, it’s just the durations part that isn’t working. All the durations are the same when they should be different. Can anyone help? Here’s my code:
If you want to understand how to write code, then you should start learning how to write code, by following a tutorial and/or getting instruction.
If you want ChatGPT to make working programs for you, then you should prepare to be disappointed. If ChatGPT could just make every program that everyone wants from a suitable description, and they actually worked, we would be living in a completely different world.
If you are hoping as a beginner that ChatGPT can give you a leg up in learning Python, that simply doesn’t work like you’d expect it to. ChatGPT literally isn’t thinking and doesn’t understand its output:
The problem isn’t that computers aren’t good enough to write programs. The problem is that any description good enough to create a useful program from would itself be a program. That is a fundamental.
We don’t write raw machine code. We don’t write in assembly languages. We usually don’t spend a lot of our time writing in C. We use Python (and other high level languages) because computers do a good job at writing low level code to fulfil our high level requests; but those high level requests are still programs.
But ChatGPT is not a tool for writing programs. It is a chatbot. It’s like going to a therapist and discussing your struggles with a technical problem - you might get a sympathetic ear, but you won’t get technical expertise.
I’ve made a lot of programs over the decades that create, parse, or manipulate MIDI files. It’s a pretty easy format to work with (although you kinda have to have a full table of message types in order to decode track data), so the OP’s basic idea is sound. [1] Or are you saying that a MIDI editor would be a fun project to write in Python? Because I can totally see that too.
FWIW, I also wrote a MIDI manipulation program once - for a very specialized purpose, and before mido existed (or at least any of the PyPI history). I agree that it’s easy enough to work with, but it sure isn’t elegant. It was definitely not designed to be the tracker format that many people would like it to be. It’s designed for recording live sessions and knowing who played what.