How many melodies are there?

The same of a author looking at a clean online page, questioning get it, is a composer looking at the 88 dark and white notes on a piano questioning diagram a melody that’s never been heard sooner than. How can one perchance bewitch the eight notes of a former scale and write a designate new melody when so many immense melodies comprise already been written? Presumably they’ve all been taken!


How many combinations are there?

So, to counter the phobia of there being no new melodies, I believed it could per chance perchance per chance be attention-grabbing to observe the different of melodies on hand to a composer his clean stave to gawk how many there potentially are.

The foremost thing to produce is to place down some floor guidelines. These are:

  1. The melodies shall be a single movement of notes — no chords, counter-melodies or basslines — correct a single line of tune. Agree with in solutions the “extinct grey whistle take a look at”? If it’ll additionally additionally be performed on a tin whistle — it be a melody.
  2. For the foremost share I’ve discounted rhythm in enlighten to focal level easiest on the diversifications of notes.
  3. All melodies desires to be contained interior an octave — C to C’ inclusive.
  4. Any of the 13 chromatic notes of the octave could perchance additionally additionally be extinct. I’ve now not restricted this to correct a serious or minor scale as many immense melodies exhaust accidentals (the dark notes in a C foremost scale). So we can consist of the final notes at some stage within the octave, including the octave soar (from C to C’) as otherwise Over the Rainbow wouldn’t depend as a melody! The notes are: C, C#, D, D#, E, F, F#, G, G#, A, A#, B, C’.

We are able to sort out this explain by starting up with the absolute best that it’s good to perchance be ready to command melody — one consisting of two notes — after which constructing up the melody size one demonstrate at a time till we watch a sample that can additionally be changed into into a system.

Two demonstrate melodies

How many two demonstrate melodies could perchance additionally additionally be written interior an octave? This one is easy and all combinations could perchance additionally additionally be written out:

Melodies that lumber up in pitch
First demonstrate 2nd demonstrate Pitch inequity (semitones)
C C 0
C C# 1
C D 2
C D# 3
C E 4
C F 5
C F# 6
C G 7
C G# 8
C A 9
C A# 10
C B 11
C C’ 12
Melodies that lumber down in pitch
First demonstrate 2nd demonstrate Pitch inequity (semitones)
C’ C’ 0
C’ B -1
C’ A# -2
C’ A -3
C’ G# -4
C’ G -5
C’ F# -6
C’ F -7
C’ E -8
C’ D# -9
C’ D -10
C’ C# -11
C’ C -12

Now, you can additionally be questioning why combinations like G# – F and E – A will now not be integrated. Right here’s because we are easiest fascinated with relative pitch, now not absolute notes. For the positive aspects of this mutter the melody C – C is completely like D – D or G – G as they’re all unison melodies (i.e., they’ve 0 as their pitch inequity). That is why we received’t depend the unison melody C’ – C’ — unison used to be already covered within the foremost table by C – C.

Having excluded C’ – C’ we comprise a full of 25 thrilling two-demonstrate melodies!

Three demonstrate melodies

The different of three demonstrate melodies rises rather sharply, but now not so indispensable that they’ll now not additionally be written out.


A limited extract of the spreadsheet that lists all 2197 three-demonstrate combinations with duplicates in grey. You are going to be ready to observe your entire spreadsheet here.

We are able to launch up by listing all that it’s good to perchance be ready to command combinations of three notes after which crossing out folk who are duplicates. It turns out that it be straightforward to search out duplicates: they’re precisely those sequences of notes that produce now not comprise any C in them. Any melody without a C can continuously be moved down the scale till its lowest demonstrate becomes a C. Therefore, any melody without a C is a replica of a melody that does comprise a C. To depend all melodies, all we wish to produce is to depend all sequences of notes than comprise a C.

There are precisely 2,197 three-demonstrate combinations, out of which 1,728 produce now not comprise a C. So there’s a full of 2,197 – 1,728 = 469 three demonstrate melodies.

Now not putrid!

Four to infinity

Now, writing down all that it’s good to perchance be ready to command combinations of notes and selecting out the ones with a C is now not a extraordinarily ambiance pleasant technique of exploring extra, so we need an equation that can portray the lengthen in melodies. Relate we are counting melodies made from $n$ notes (so we’ve already covered $n=2$ and $n=3$). There are 13 picks for what the foremost demonstrate could perchance per chance be (one of C through to C’), 13 picks for the 2nd demonstrate, etc. This means that the different of all sequences of $n$ notes is

  [ underbrace{13 times 13 times ... times 13}_{n} = 13^ n. ]    

From this we wish to subtract the sequences that don’t comprise a C in them. For this kind of sequence there are 12 picks for the foremost demonstrate, 12 picks for the 2nd demonstrate, etc. So the different of all sequences of $n$ notes that don’t comprise a C is

  [ underbrace{12 times 12 times ... times 12}_ n = 12^ n. ]    

Which tells us that the different of sequences of $n$ notes that produce comprise a C (the different of melodies) is

  [ 13^ n - 12^ n. ]    

We are able to even be more in vogue and accept the different of melodies for any scale. If the different of notes within the scale is $s$ (so in our case $s=13$) then the different of melodies that comprise $n$ notes is

  [ s^ n - (s-1)^ n. ]    

However let’s return to our example with $s=13.$ Substituting ever larger numbers for $n$ — the scale of the melody — provides us the next technique to our authentic demand, the different of doable melodies interior an octave:

Length of melody No of that it’s good to perchance be ready to command melodies
2 25
3 469
4 7,825
5 122,461
6 ca. 1.84 million
7 ca. 26.9 million
8 ca. 385 million
9 ca. 5.4 billion
10 ca. 75 billion

So, a mere ten demonstrate melody will fabricate over 75 billion doable melodies of 13 notes at some stage within the octave! It be going to bewitch our composer some time to work his technique through those. A pc would accept it more uncomplicated — if someone out there produces a program that cycles through all of them, then please enable us to clutch!

Bring on the rhythm

It could perchance perchance per chance be good to side in rhythm as effectively, correct to be completist, as very few melodies are sequences of precisely the identical size of notes.

Fortunately this is indispensable more uncomplicated to compute. Doubtlessly demonstrate lengths could perchance additionally additionally be anything else between a semiquaver (a sixteenth demonstrate) and a semibreve (a total demonstrate). (I’m discounting hemi-demi-semiquavers!) Pretty than consist of every single variation I comprise these could perchance per chance be a perfect different of notes that could perchance per chance be on hand to exhaust:


This means there are 8 masses of that it’s good to perchance be ready to command lengths of a demonstrate, and each new demonstrate added to the sequence multiples the different of combinations by 8. for a sequence of $n$ notes the system that counts the masses of rhythm diversifications is completely $8^ n,$ which provides us the closing calculation as under:

Length of melody No of that it’s good to perchance be ready to command demonstrate combinations Rhythm diversifications (ignoring melodies) = 8n Option of melodies (demonstrate combinations multiplied by rhythm diversifications
2 25 64 1600
3 469 512 240,128
4 7,825 4,096 32 million
5 122,461 32,768 4 billion
6 ca. 1.84 million 262,144 4.8 x 1011
7 ca. 26.9 million ca. 2.1 million ca. 5.6 x 1013
8 ca. 385 million ca. 16.8 million ca. 6.4 x 1015
9 ca. 5.4 billion ca 1.3 x 108 ca. 7.02 x 1017
10 ca. 75 billion ca. 1.1 x 109 ca. 8.25 x 1019

Or, for that final quantity:

There are around 82,500,000,000,000,000,000 melodies that are 10 notes long.

That is a sexy few to work through! A truly tough approximation reveals it be over 2.6 trillion years price of cloth.
And as talked about at the launch up, this would now not even launch up to comprise in solutions the diversifications equipped for by harmonisation, orchestration, tempo, or heavens above — bringing in a new counter melody!

So I comprise the message is: there is now not any excuse for writers’ block.

About the author


Oli Freke is a London basically based mostly musician and composer who’s variously supported the Human League with electro band Cassette Electrik, written for TV and fair recently had club chart success with tune Line-1. He’s for the time being waiting for working through all 8.25 x 1019 melodies in due course.

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button