I've run into this a few times and did just that. It hallucinates a js or python or micropython package, I get annoyed trying to find or use it because it lacks features I explicitly stated I needed, or it just doesn't exist, and then make it write the whole thing for me from scratch. I don't use ChatGPT anymore (the model they have on the free tier has become terrible in the past few months), but Gemini 2.5 Pro Preview free through AI Studio (ex-API) is generally up to the task here.
Most recently when this happened, I made it write an SF2 loader/parser/player and a MIDI parser/"relay" library compatible with it for javascript to use in a WebGL game. It's familiar enough with ABC notation that you can have it write a song and then write a converter from modified ABC notation to MIDI, too. It can generate coordinates for a xylophone model with individual keys in WebGL with no fuss and wire it up to the SF2 module to play notes based on which key was struck. We can do things like switch out instruments on tracks, or change percussion tracks, or whatever, based on user interactions without fuss.
It's not worth setting up a whole repo for and documenting, because when I make something with it, I inherently prove making it is trivial.
Most recently when this happened, I made it write an SF2 loader/parser/player and a MIDI parser/"relay" library compatible with it for javascript to use in a WebGL game. It's familiar enough with ABC notation that you can have it write a song and then write a converter from modified ABC notation to MIDI, too. It can generate coordinates for a xylophone model with individual keys in WebGL with no fuss and wire it up to the SF2 module to play notes based on which key was struck. We can do things like switch out instruments on tracks, or change percussion tracks, or whatever, based on user interactions without fuss.
It's not worth setting up a whole repo for and documenting, because when I make something with it, I inherently prove making it is trivial.