This is part of a series where I post every day for 24 days. See Advent of Writing: 24 days of posts.
On the 4th day, I played with AI-generated music. Try it here
I’m posting late again, this won’t be very polished. Still tinkering with ChatGPT. I tried to ask it to write a song, and after failing to get it to do anything original, I ended up asking for notes for a specific song. The result is, as far as I can tell, gibberish:
I wouldn’t be surprised if you could get it to be more accurate though. I thought it’d be fine to make it write a program to play these notes with the Web Audio API. Even better, I asked it to add some 80s synth flavor to it.
It wrote a Web Audio program that included delay and reverb. You can see and run the program.
It didn’t quite work on the first try; the Web Audio code was correct but it was playing all the notes at once. When I more specifically told it to play the notes one after the other it generated the code at the end with
I think my favorite part is all the code comments.
It also originally had
const frequency = /* TODO: calculate frequency based on pitch and octave */;. I had to ask it to do that part too and it generated the
calculateFrequency function. It’s interesting that it tried to get by without doing that first.
Unfortunately it doesn’t sound anything like Clair de Lune.