The Parsons Code Eliminates Earworms

For two weeks, I had a relentless earworm that randomly materialized and would not vanish. Musical friends could not identify it, Shazam and Soundhound were no help, and I could not even place the composer (Mozart? Beethoven?). The same few notes drove round and round my head and worst of all, I couldn't recall the rest of the piece! When my frustration had me systematically listening to my entire classical music library, my husband discovered something called the Parsons Code and then the Parsons Code Database for Melodic Contour. Musipedia explains the Parsons Code:

Each pair of consecutive notes is coded as "U" ("up") if the second note is higher than the first note, "R" ("repeat") if the pitches are equal, and "D" ("down") otherwise. Rhythm is completely ignored. Thus, the first theme from Beethoven's 8th symphony that is shown above would be coded DUUDDDURDRUUUU...

In his "Directory of Classical Themes" (Spencer Brown, 1975), D. Parsons showed that this simple encoding of tunes, which ignores most of the information in the musical signal, can still provide enough information for distinguishing between a large number of tunes.

(I feel like more people need to know about this remarkable system, though if I am late in the game, then I'm glad that I've finally come across it now.)

So what was the culprit?

 Harpsichord Concerto No. 7 in G Minor, BWV 1058. by Johann Sebastian Bach

I had the first six measures stuck in my head in a loop for two weeks. Once I found the sheet music and played the rest of it, the notes stopped looping in my head!

Thanks, Musipedia.org, for preserving my sanity.