Mixing my own music with AI

Suno AI has an “upload audio” feature, allowing users to upload up to 60 seconds of their own content to be extended by the AI. So earlier this month I had some fun feeding it 45-60 clips of my own music and having the AI write lyrics and turn the clips into choir songs. It’s interesting to hear how the AI uses the melodies, chord progressions, and orchestrations provided in its own creations. The lyrics are a bit amateurish, but serviceable; I was too lazy to write my own. I’m calling the project Hannifin x AI. Here’s the first installment, based on my classic piece “Hour by Hour”; the first 60 seconds are from the original piece, while the rest is AI-generated.

I did the same with 18 other of my pieces. Some things I noticed:

  • The AI works best with simple 8-bar melodies, or 4-bar phrases. It doesn’t seem to “parse” weirder phrase structures very well.
  • It’s not very good at extended the input instrumentally, in my opinion; it quickly starts to sound too repetitive. Having it produce lyrics and turning the music into a song seems to work better. (Melodic repetition seems easier to bear with alternating lyrics.)
  • If you want the AI to generate the voice of a choir, feeding it music from the louder, more energetic and melodic parts of a piece seem to work better, especially if it features a prominent string section. Otherwise you’re more likely to get a soloist, and the music it generates is less likely to sound like a natural continuation of the music you provide.
  • For whatever reason, some tracks just seem to work better than others; maybe it depends on how “familiar” the AI is with the melodic and harmonic patterns? For some tracks, it gave me some pleasant results right away. Other times I had to roll the dice over and over to get something acceptable.

There were some pieces I tried for which I could not get any output that I was happy with, including The King’s AssassinThe Moon Dreamed By, and On the Edge of a Dream. And there was one track, Silver Moon Waltz, for which I got a couple songs I was pleased with. Anyway, I’m done trying for now.

As for the video above, I made it with Blender 4.2, which took a little time figuring out, mostly with various tutorials on YouTube. I’m not completely satisfied with the results. What’s supposed to be “dust” looks perhaps too much like snow and moves a bit too fast, and the text looks a bit weird. Turns out trying to create a sort of “drop shadow” effect on text in Blender is pretty much impossible; I had to sort of fake it with compositing cheats, and I’m not sure I did the best job. (I could’ve just put the text on the background picture and used an image editor to create the drop shadow, but I wanted the animated frequency bars to have it too.) Also, the text might be a bit too bright, but I blame that on the VR display I get with Immersed in the Meta Quest 3.

I’ll upload the other 19 songs I created soon!

 

The Iamus computer composer

According to this article:

“We have taught a computer to write musical scores,” says Gustavo Diaz-Jerez, software consultant and pianist.

“Now we can produce modern classical music at the touch of a button.”

Awesome! Let’s hear some examples!

Oh.

I’ll keep working on my own attempt for now. I want my Mozart Symphony Generator.

In the meantime, here’s Emily Howell creator David Cope performing some John Cage:

Computer generated sea chanteys!

How often have you been sitting there thinking: “Oh my gosh! I wish I had some new sea chantey melodies to play on an instrument and/or write lyrics to!”  Probably more times than you care to count, eh?

Well, fear no more!  The sea chantey melody generator is finally here!  That’s right; in less than a second, the sea chantey melody generator will generate hundreds of sea chantey melodies for you, filled with those catchy memorable sea chantey melody patterns.

Here is a sample of 100 sea chantey melodies as generated by the generator.  Feel free to write lyrics for them and add them to your collection of sea chantey goodness.

The sea chantey melody generator is available for just 5 easy payments of $50,000.

Seriously, though, I’ve been working on getting my melody generator to compose in “styles” and sea-chantey-style was my first experiment.  I look forward to trying some other styles.  As usual, the melody generator is restricted to 8-bar melodies in 4/4 time, a restriction I still haven’t programmed my way out of, but trying to get the generator to work with styles has been a more interesting endeavor recently.

1,000 computer generated melodies…

For the past couple days, I’ve been working on getting my melody generation program to output MIDI files so I wouldn’t have to convert them manually from a text file, which takes an annoying amount of time. And… I’ve done it, haha! So now I can tell my program… hey, I want 1,000 melodies, go. And it spits it all out over the course of a couple minutes. So here are 1,000 short little MIDI files my program wrote just a few moments ago, in a zip file:

Zip file with 1000 computer generated melodies

Some notes:

1. – Again, the program is currently restricted to 8-bar melodies in 4/4 time, and must start with the I chord and end on the tonic.

2. – For the sake of a little variety, I set the tempo to be a random BPM between 80 and 150, and the key signature to be random between A major and D major (it starts in C major then just shifts all notes up or down).

3. – There is one small bug you might hear in some of the melodies: the bass notes are shifted offbeat. I’m workin’ on it. Fortunately it doesn’t seem to happen often.

Yet even more computer generated melodies…

Here are yet more computer generated melodies from my in-development automatic melody generator. I have made a lot of changes to the algorithm since I posted the last set of examples, but I’m not sure how much you can actually hear. Still more work to be done… anyway, here are 12 more melodies…

Computer generated melodies

Enjoy!

I’ll probably spend another week on the main algorithms, then I’ll start trying to add more diverse capabilities, like different time and key signatures.

More computer generated melodies! Woohoo!

Even though I’ve still got plenty of work to do on my automatic melody generator, it’s at the point now where I’m finding it quite addicting. Here are a bunch of melodies it came up with today (I think there are 12 altogether, each stated twice):

Computer generated melodies

Again, I don’t think the melodies sound super fantastic by themselves, but there are definitely some surprisingly good phrases, in my opinion.

Some notes:

1 – Again, it’s still limited to 8-bar melodies in 4/4 time in C major that begin and end on the I chord and can only use the basic triads. I still have algorithmic changes to make before I start expanding its abilities in this area. (For the audio above, I transposed it up a step to D major; sounded just a bit better to me.)

2 – The program is “creating” its own “melodic knowledge” and, as you might hear, the biggest problem this creates is that it likes to write large melodic leaps every now and then, which can sound funky. It didn’t do this before because it based its melodies on observations, and large melodic leaps like that would never (or rarely) be observed. So I’m going to have to hardwire an interval limit into the algorithm, perhaps letting the user set it.

3 – In the last two melodies, I gave the program the ability to use to 16th notes. You don’t hear them in the other melodies because the program wasn’t allowed to use them, but it’s an easy ability to give the program. Triplets, on the other hand, will be tricky… I guess I’ll have to figure out those at some point. Meh… that can come much later…

4 – The program outputs a text file with note values and accompanying chords; it doesn’t actually output the sound you hear in the MP3 … I had to manually enter the info into Overture 4 and use Garritan Personal Orchestra to create the actual sounds.

Melody generator update…

My obsession with programming an automatic melody generator (that actually gives good results, unlike just about every other melody generator out there) continues. Again, the program works by analyzing existing melodies and “learning” from them. In my 2008 version, the program analyzed the given melodies while it composed new ones from them. Now the program stores its “knowledge” so it doesn’t have to analyze a melody more than once. Of course, there’s still the problem of getting the program to find the right sort of knowledge and to use it appropriately. But what I have is coming up with some interesting results. I’ll post more later, but here’s one melody the program wrote early this morning: MelodyExperiment2.mid (melody stated and repeated ad nauseam in pizzicato… the output of the program just gives chords and melody numbers; the tempo, the instrument choice, and alberti bass were added by me)

EDIT: By the way, obviously some of the melodies it outputs sound much worse than that. That’s one of the better ones…

Unfortunately there are still a lot of limits in the program that need to be dealt with:

1. It can still only compose an 8-bar melody in 4/4 time. I need to give it a wider range of time signatures (3/4, 2/4, and 6/8 at the very least), and I need to let it be able to compose 16 and 32 bar melodies, and “extended” melodies, such as a 10-bar melody which is really just an 8-bar melody that takes two extra bars to resolve. Ideally the user could choose the bar length and time signature.

2. It can only compose in C major. That might seem trivial; can’t the program just transpose the melody up and down afterward generating it? Unfortunately that can lead to notes that are way too high or way too low. To keep the melody within a certain range, we’ll have to deal with this.

3. It can only compose diatonic melodies. It can not yet shift into other keys or limit itself to a certain scale. Fortunately I don’t think this would be very hard functionality to add; it’s just a matter of giving the program more options, and making sure it uses them appropriately.

4. It can only compose within a certain range of notes. Which is fine, but ideally the user could decide what range is allowed, and what interval leaps are allowed.

5. There are limits on chord progressions. It must always start and end with the I chord. This makes it sound nice and complete, but it should have the ability to start on a different chord or something. It also sometimes comes up with some pretty odd chord progressions that are technically fine, but just odd. It would be interesting to program an “inventive” variable, telling the program how much it should do whatever it wants with the chord progression (within reason), and how much it should adhere to what it “knows.” Also, it currently only recognizes the main triads; it ignores major 7ths, major 9ths, sustains, etc. I’m not sure that matters much; a listener could always change that himself if he wants to use the melody for something, so if I do add that feature, it will probably be the last thing I concern myself with.

And then matters of practicality:

6. It outputs numbers in a text file which then have to be laboriously converted manually into a MIDI file, which takes too long. It should be able to output a MIDI file (or files) by itself, or at least a much easier to read text file.

7. It’s programmed in Java. To get it to work on the Internet (if that’s what I decide I want), it will probably have to be converted to PHP, and we better make sure it’s not too computationally heavy for that. (I don’t think it would be.)

That’s all! Enjoy that beautiful melody! Look out for more!