Are We Running Out of Melodies?

First warning: This article contains math.

Second warning: I’m not very good at math.

I don’t know why, but tonight I found myself pondering the question “How many melodies are there?” Maybe I was worried that we’re running out of them. (A quick survey of recent pop music might suggest this.)

Human beings have been writing songs for as long as there have been human beings. The oldest written song is the Hurrian Song to Nikkal, written around 1400 BC, but even in prehistoric times there were no doubt songwriters, whose melodies are now lost to us.

There are now more than 7 billion people in the world, so there must be more songwriters living now than at any other time in history. Heck, there are probably more songwriters now than there were people at some point in the past.

And all those songwriters are using up melodies. Not always of course, since imitation and blatant thievery are well-established parts of the creative process. But unless we’re all just endlessly recycling the same melodies, some of us must be inventing new ones and therefore depleting the supply of melodies not heard before.

How long until there are no new melodies?

OK, here’s where the math comes in. For the sake of this discussion, let’s limit ourselves to the Western chromatic scale, i.e. all the keys on a piano. But two melodies that are different only by shifting some of the notes to a different octave aren’t going to be heard as different melodies. For example, consider these two melodies:

melody 1


melody 2



If you tried to claim that the second melody is original, I’m afraid people would laugh at you, and if you took it too far, Mozart might sue you.

So we’re really only dealing with 12 notes, because every other note is just one of those notes shifted to a different octave.

How many melodies can we make with 12 notes? It depends on how long the melody is. If our melody is only one note long, then obviously there are only 12 possible melodies. If our melody is two notes long, then there are 12×12, or 144, possible melodies. Here are the first 36 of them; you can probably figure out the rest:

two-note melodies





Now, what about a melody that’s 3 notes long? There are 12x12x12, or 1728 possibilites. Similarly, there are 12x12x12x12 (­20736) 4-note melodies, 12x12x12x12x12 (248832) 5-note melodies, and so on. The formula to calculate the number of possible melodies using N notes is 12^N, meaning 12 multiplied by itself N times. So if we want to know how many possible 20-note melodies there are, we just multiple 12 by itself 20 times. The result of that calculation is 3,833,759,992,447,500,000,000.

Now we’re getting into some big numbers, and I’m starting to feel a little better about the remaining supply of melodies. In fact, the number of possible 22-note melodies is roughly the same as the number of stars in the universe. Now I’m feeling safe.

But so far we haven’t tried to draw any distinctions between good and bad melodies. Those 144 two-note melodies, for example, are probably not very interesting. And a random collection of 22 notes generated by a computer program might be a melody but is not likely to be a good melody.

So even though on a theoretical level we’ll never run out of melodies, the more important question is “will we ever run out of good melodies?” I don’t know. But here’s a melody, which I think is a pretty good one:

22-note melody



It has 22 notes, so it’s like one out of all the stars in the universe. And if you hum it, there’s a good chance that you and I and other readers of this article are the only human beings who have ever lived who have ever heard this melody.

That’s pretty cool.



  1. Jeff Fair says:

    Hi Tom,

    Long time….Enjoying your blog!

    I have to point out that your potential maximum melody calculation needs a little more work though. A melody is about the relationship between a linear group of notes in time,(not their absolutes). So the relationship between a melody two notes in length would not be 12 x 12 because all similar intervals would have to be counted as the same melody (i.e. all major 2nds, minor 3rds, etc…) also you haven’t accounted for that old cretin Rhythm. :)

    Hope I see you at NAMM!


    • tbajoras says:

      Hey man! There’s a name I haven’t seen in a while. Hope life is treating you well. I’ll only be at NAMM on Saturday, and I have an overly optimistic schedule but maybe we can arrange to bump into each other. Anywhere/when in particular you’ll be? Regarding the question about whether we’ll ever run out of melodies: It was really just a quick, back of the napkin, calculation, more than anything just to start a discussion. (Hey, I guess it just did!) So, yeah, I didn’t take into account transposition (e.g. just because you recorded “Hey Jude” in a different key doesn’t mean you’ve written an original melody) nor rhythm. Also, I have a hunch that there are certain psychoacoustic principles that cause listeners to hear two melodies as “the same” even though they might differ slightly; where do you draw the line between two melodies being different versus one just being the other one played incorrectly? :)

  2. Jeff Fair says:

    Hey Tom,

    Really great to find you here. It would be fun to catch up.

    We will probably be at NAMM on Sunday and very late in the day Saturday. Email me and I’ll send you an email address that works better on my phone.

    See you soon, I hope.


  3. Jeff Fair says:

    Hey Tom,

    Really great to find you here. It would be fun to catch up.

    We will probably be at NAMM on Sunday and very late in the day Saturday. Email me and I’ll send you an email address that works better on my phone.

    See you soon, I hope.

  4. Juliann says:

    Thanks for the excellent advice, it actually is useful.

Leave a Reply

Your email address will not be published. Required fields are marked *