1

There are a lot of great melodies out there, many of them classic (both classical pieces and electronic songs). They are unique and will never be repeated.
Given that melodies are created using a finite number of notes and time signatures, can we assume that one day we will run out of melodies and new music will become boring?
As a side note, can we build a machine or software to try out all different possible nice melodies that has ever been written and will ever be written?
Also, I'm not a mathematician, but I did a small calculation with leftovers of general math as to the number of possible arrangements of the 13 notes in a 4/4 bar (assuming 16th notes are used to create melodies), which gives me infinity:

factorial(13)^factorial(16)=infinity

enter image description here

If that is correct, the possibilities are endless, but obviously not all possibility will be a great melody. So, will can we theoretically run out of melodies one day?

14
  • 1
    Melodies can be longer or shorter and there are a huge number of rhythms possible even when playing the same note. Also, the same melody can sound very different when it is played with a different harmony. You might consider adding those factors to your calculations. Oh yeah, I don’t know what app you put that calculation into but the actual answer is not “infinity”. That is not an answer to any calculation ever. Commented Dec 18, 2021 at 14:36
  • 8
    DuckDuckGo is not a great tool for mathematical calculations that go beyond the basics. Wolfram Alpha does a better job, telling you that (13!)^16! is a number with about 100 trillion (10^14) digits. Stupendously large, but not infinite. Commented Dec 18, 2021 at 14:50
  • 3
    Yes, one day - but what exactly constitutes a 'melody'?
    – Tim
    Commented Dec 18, 2021 at 18:50
  • 4
    @MichaelSeifert I cry for the future of humanity every time someone thinks "my calculator says 'infinity' " so that must be the answer" . Ditto for " x = 1/3; 3*x = 0.0.99999999 oh my calculator is broken!" Commented Dec 21, 2021 at 15:34
  • 1
    In one sense, Twelve-Tone composers were worried we wouldn't run out of melodies :-)
    – DjinTonic
    Commented Dec 22, 2021 at 17:13

5 Answers 5

8

Your "leftovers of general math" have, I'm afraid, lead you astray. If we want to look at all possible 4/4 bars with 16 sixteenth notes, and each sixteenth note is picked from one of 13 possibilities (with repetitions allowed) then then number of such bars is 1316, not (13!)16!.

Now, 1316 is still a stupendously large number: it's 665,416,609,183,179,841. If we built a machine to play all of these 665 quadrillion bars in succession successively at a tempo of quarter note = 100, it would take approximately 50 billion years to complete.1 This is three times longer than the Universe has existed so far, and ten times longer than the remaining lifetime of the Sun. So while the stock of such "melodies" is finite, it is so stupendously large that we will never really risk "running out".

Moreover, the number of cells in a human brain is "only" around 100 billion or so. We don't know how many neurons are dedicated remembering a melody, but if we guess that each melody requires at least one neuron to remember, then we could only possibly remember at most 100 billion of these 665 quadrillion melodies, which is about one in six million. So even if the human species lasts another 50 billion years, it is unlikely that music will get "stale", since there is no way we could possibly hold even a small fraction of all these melodies in our minds.


1 Showing my work: (665 quadrillion bars) * (4 beats/bar) / (100 beats/minute) / (525600 minutes/year) = 50.64 billion years.

4
  • 1
    It's easier to memorize those melodies that are one note away from more famous melodies, transposed versions of famous melodies, and/or plain old rearrangements of famous melodies, right? In practice, that significantly increases the number of melodies we can memorize and reduces the number of "non-boring" melodies (we can keep chaining Christmas carols together and still claim each chain/playlist is a different melody, although the carolers will call you out at some point). Whether that merely reduces the number of "non-boring" melodies to a number too big to memorize is left uncertain.
    – Dekkadeci
    Commented Dec 18, 2021 at 15:33
  • This is inaccurate math -- not that it matters. Pick a melody - say, "twinkle twinkle" and play it in all 12 distinct keys. It's still the same melody. Whether starting a melody in the middle and finishing with the first half counts as a new melody i leave to the OCDists :-) Commented Dec 21, 2021 at 15:36
  • 2
    @CarlWitthoft: if you don't want to count transpositions as distinct, that's equivalent to assuming the first note is C (or whatever your favorite note is) and then choosing the remaining 15 more relative to that. So the answer would be 13^15 or something like that. Commented Dec 21, 2021 at 19:33
  • ...in which case maybe the Sun burns out but the Universe doesn't end. We might run out of notes! :-) Commented Dec 22, 2021 at 15:32
4

If you draw a sequence of length k (your melody of 16 notes) from a pool of n items (your 13 note names), there are nk possibilities. Note that nk (n to the power of k) is much, much smaller than n!k! (factorial of n to the power of the factorial of k), except for special choices of small values of n and k. Yet both numbers are finite and both are extremely large on a day-to-day scale, given reasonable values for n and k.

Damien Riehl and Noah Rubin did this exhaustively with n=8, k=12, amounting to over 68 billion melodies.

nk is the result, iff no further rules apply to the items in the sequence. This means no rules like "we can't have so many repetitions" or "F right after B is not allowed" or "after D comes E or C". As a consequence the number of distinct beloved melodies is smaller. Some of the melodies may disqualify because they do not fit the expectations of the listeners. E.g., the tritone leap F–B could be a candidate thereof. A large portion of the total number of melodies are variations of melodies, already used. Those variations include transpositions, inversion, retrograde, replacement of a single note, etc.

However, the number of melodies is larger again, if you consider melodies longer than 16 notes, i.e. greater k, or melodies comprising a greater number of note names, i.e. greater n. Greater n is achieved by increasing the possible ambitus of the melodies, or by choosing a finer tuning system with more note names in the same ambitus, or both. Considering that music is not only defined by melody, the number of distinct beloved pieces of music is larger than the number of distinct beloved melodies. This comes about since other dimensions of music, most prominently rhythm and harmony, can be completely different even when the melodies of two pieces coincide.

3

To calculate this, we first have to define exactly what a melody is. And we go off the rails immediately.

Michael Seifert calculated the number of unique 4/4 measures of music consisting of 16th notes and notes constrained to a single octave. But that's not every melody. The calculation does not count measures that use triplets or other tuplet rhythms, are written in time signatures other than 4/4, span more than an octave, have rests, or even use quarter notes or any rhythms at all besides 16th notes! If we add all these elements into the mix, we can recalculate how many unique measures are possible. But that still isn't the number of melodies possible.

Melodies can last more than one measure, so now you need to consider what happens if you combine our unique measures together. Be sure not to forget that melodies can start or end partway through a measure, and also that notes can start on one measure and end on the next! But that gives us all the different combinations of notes possible while ignoring how they're played. Elements like dynamics, articulation, and phrasing play an enormous role in giving melodies their character, such that two melodies with the exact same notes but performed differently can sound very different from each other. You hear this all the time: Think about a super hero movie that uses a quiet version of the main theme when it looks like all is lost.

But that still isn't what a melody is. The same melody played by two different instruments can sound very different. There same melody played at a different tempo can mean something else entirely. And then you get into philosophical ideas about whether a melody can be separated from its harmony. There are cases where the exact same recording of the same melody hits totally different depending on the chord progression it's sitting on top of.

Don't forget about microtonality and alternative tuning systems! And then you have pieces like Threnody for the Victims of Hiroshima, a truly bone-chilling orchestral piece that uses totally unhinged wailing strings to paint the horrors of the nuclear bomb in a way that cannot begin to be described with traditional notes or rhythms. The score is a sea of wavy lines and curves instructing players how to create their textures without tying them down to tonality.

At this point, we should just give up counting notes. Let's just go the whole way and say that every single unique sound wave is a different melody. How do you even begin to count those -

Aha! We can count the number of unique audio files we can generate! Strictly speaking, it's impossible to perfectly capture every single possible unique sound wave using digital technology, but the differences are so incredibly subtle that it is utterly beyond human ability to tell the difference. And counting unique sound files is easy. Let's say we want to count every single WAV file 1 gigabyte or smaller in size as a unique melody. Each byte in a WAV file is a number from 0 to 255, and there are one billion bytes in a gigabyte. Including all the WAV files smaller than 1GB, there are 2*(256^1000000000)-1 different possible melodies. It's an incomprehensibly big number, but we did it.

Except we didn't. The same WAV file played out of two different speakers will sound different - sometimes dramatically so. And then there are the different types of speakers. You have stereo speakers, mono speakers like built into a phone, headphones (which have significantly different psychoacoustic effects than speakers that aren't clamped on your ears) - and there are massive PA systems used in stadiums and concert halls, enormous surround sound systems used in movie theaters, speakers in stores playing background music...

You could argue that all of these are really the same melody. But it's not just a theoretical idea, there are pieces of music that pointedly use unique sound setups as a core part of their identity. In high school band, we played some pieces with randomized elements where we got off the stage, spread ourselves around the audience, and then played luxurious walls of sound, bathing the audience in rich acoustics from all directions. Stage musicals will sometime have singers walk around the audience, giving a sense of intimacy that isn't possible on stage - or with two speakers. Pushing this kind of idea especially far, the VR game Rez Infinite procedurally generates its music directly in response to the player and enemies' actions. Using VR, this is in surround sound, with the direction notes come from being used as an ever-changing cue of where the player needs to be paying attention. The soundtrack album doesn't even include the final boss music, which is so completely generated on the fly that rendering a single canonical version of the music isn't possible. For all these pieces of music, the way they are heard is an integral part of what defines their melodies. A recording of the same piece played out of stereo speakers is fundamentally an incomplete facsimile of the original musical statement.


The lesson behind all of this is, as long as people are making music, they will always be pushing the boundaries of what music is. If the same twelve notes get old, we'll play with microtonality and alternate tunings and noisescapes. If 4/4 rhythms get old, we'll play with tuplet rhythms and unusual time signatures. If listening to music with our two ears gets old, we'll invent whole new ways of transmitting musical sounds, like VR and IMAX surround sound, that reconextualize what the most basic ideas of space mean in music. And when we've exhausted all of those possibilities, our descendents will discover and explore new boundaries in music.

I am optimistic that we will never run out of fresh musical ideas, even if the ideas we can conceptualize now are, strictly speaking, finite. Music, as with any art form, is a malleable thing with no concrete definition. When we've run out of space to explore the ideas we're aware of now, new ideas to challenge will come into view.

3

Lots of long answers.

The simple answer is "no."

There is no length limit to a melody. In other words a melody can - at least in concept - be of infinite length.

You can't run out of something that is infinite.

You can't run out of melodies.

Now the answer needs to be lengthen to respond to your particular wording of the question.

...Given that melodies are created using a finite number of notes ... new music will become boring ... all different possible nice melodies

That simply is not true about the length of melodies. I think that is a 'false dilemma' fallacy. You're asking a question with a limitation that forces a certain answer. Also, you're bringing in "boring" and "nice" which are weasle words. You're trying to specify with those, but in fact those words are vague.

But, let's just go with it as you wrote it. You did not specify mathematical infinity, and you mention "we". In a way, you're asking the question from a more practical perspective, not a purely mathematical one, and that allows for at least one possible answer.

In the book The Math Behind the Music by Leon Harkleroad a "musical dice game" is described. Basically, the game works that someone throws dice to select measures of music from a table for a sixteen bar minuet. Each measure can have up to twelve choices. That certainly satisfies your idea that melodies what a finite length, the game is just for a sixteen bar minuet. Also, it sort of satisfies your idea about not "boring" in that each interchangeable bar was written by a composer so that it "works" musically.

The really interesting part is this note from the author:

"A complete continuous performance of these trios, at a steady minuet tempo. would take just under 900,000 years (without repeats) attributed to Joseph Haydn"

In terms of "we" and "run out", just using simple variation techniques (which essentially is the form of the dice game) on sixteen measures results is so much music that "we" would evolve into a different species, before this one game would "run out" of combinations!

For all practical purposes melodies will not run out.

You may be interested in these:

0

Strictly speaking your calculation isn't even close to infinite:

  • 13! = 6.227.020.800 < 10^10
  • 16! = 20.922.789.888.000 < 10^14
  • so (13!)^(16!) < 10^140, which your computer may not be able to display

But yes, we won't run out of melodies so easily. Even with 10^10 people on earth right now it will take "some time" to listen to all, if each individual listens to all 10^14 songs (which fall out of the sky in no time) for just a second.

;-)

2
  • Is there any finite number that is close to infinite?
    – phoog
    Commented Mar 15, 2023 at 11:31
  • Not really: all are infinitely away from infinity ;)
    – MS-SPO
    Commented Mar 15, 2023 at 12:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.