Are Ed Sheeran's Shape of you and Sia's Cheap thrills rhythmically similar ?

How to measure rhythmic similarity of songs ?

At some point while listening to music we have all wondered if the song we are listening to sounds a lot like some other song ? This is not suprising since artists have always tried to churn out new rhythm patterns based on successful music that came out earlier. This makes perfect sense with research suggesting that people tend to like certain kind of rhythm patterns more than others. But quite often such similarities are based on listener's perception and is therefore highly subjective. This leads us to seek if there is a way to measure the rhythm similarities of two songs quantitatively.

So how to measure rhythmic similarity of two songs ? Can we classify the songs based on their rhythm patterns ? Can we visualize the rhythm of a song ? If we can assign similarity scores to songs, then can we determine the most unique song and the most similar sounding song pairs ? Further by combining uniqueness of songs belonging to a certain artist, can we measure uniqueness of an artist ? This post attempts to answer these questions.

About the data-set used

Before we begin, a note about the dataset used in the project. This project uses MIDI data to compare rhythm patterns of songs. MIDI (short for Musical Instrument Digital Interface) carries event messages, data that specify the instructions for music, such a note's notation, pitch, velocity and tempo of the song. The MIDI data was personally collected from Musescore. We considered artists by total number-one singles on Billboard Hot 100 chart for every decade from 1960s. For each artist, we then obtained MIDI data of all the songs available on Musescore. For artists from before 2000s, MIDI data were available for only few songs. So in order to expand the dataset, we also considered popular artists of 2000s and 2010s not in the Billboard Hot 100 chart. Overall the dataset consists of MIDI data for close to 400 songs. Although this is still a small dataset, the analysis that follows here does provide interesting insights into visualizing and measuring similarities in rhythm patterns of songs.

Keep scrolling to learn more.

How to measure similarities in rhythm ?

How to compare rhythm similarity of two songs ?

What is Rhythm ?

Here are 3 instantly recognisable rhythm patterns from across the eras

Simply put,

Rhythm is characterised by

Here are visualisations of rhythm patterns in few popular songs

We observe how similar Ed Sheeran's Shape of You and Sia's Cheap Thrills are visually.

We use the features of a rhythm pattern (pitch and on-off duration of the notes present in the song) to quantify the difference in rhythms and assign similarity scores to each pair of songs.

For example, the following graphic shows how similar songs are rhythmically to Ed Sheeran's Shape of You

Backing our visual interpretation, the algorithm does assign very high similarity score to Shape of You and Cheap Thrills

To substantiate this method of measuring rhythm similarity, let us hear the vocals of one song with rhythm of another song.

We can hear how well the rhythm of Shape of You fits to Cheap Thrills whereas fails miserably with Beyonce's Halo

Thus we have now established a reliable way of measuring similarity of rhythms in two tracks.

Rhythm visualisation

We now have a method to measure similarities in rhythm patterns between any two songs. In the process of determining that, we also developed a methodology to visualize the rhythm pattern of a song. Before proceeding to determine the most unique songs, most similar song pairs, most unique artists, let us explore the rhythm visualization in more detail.

To recap, this is how we visualized the rhythm of a song. Each note in the song is shown as a circle. The pitch of the note determines the distance of the circle from center. The colors denote the various notes present in the song. The space between the circles are based on the on and off duration of the notes. Together these features constitute a rhythm pattern. Based on this, we can now plot the rhythm pattern of an entire song. We can plot the rhythm over time horizontally but instead let us do it in a circular fashion. This will help us visualize better the repetitive patterns present in the song. So now the rhythm patterns will be shown as circles with clockwise direction representing increasing time.

This next interactive graphic lets you visualize rhythm patterns of songs. Search from the list of available songs to visualize the rhythm patterns of some of your favourite songs.

Visualize rhythm of a song

Now that we have visualized rhythms of few songs, let us examine if rhythms can be categorized into few distinct types. Based on visual inspection, I came up with the following categories of rhythms.

Types of Rhythms

  • Repetitive Rhythm
  • These are songs which have a consistent rhythm throughout the song. Such songs are characterized by the presence of the same repetitive beats over and over. This is a popular category of rhythm patterns. Songs like Ed Sheeran's Shape of You and Coldplay's Viva La Vida are classic examples of this category. The near perfect symmetry in the rhythm patterns of such songs are strikingly evident.

  • Alternating Rhythm
  • Alternating rhythms are where songs possess multiple beat patterns switching amongst these patterns during the course of a song. These are often used to make the song diverse and keep the listener engaged by using beat patterns of varying tempo or style. One of the classic songs of this variety is Eminem's Love the way you lie ft. Rihanna where the two rhythm patterns, one during Rihanna's vocals and the other during Eminem's rap are very distinctly visible.

  • Staggered Rhythm
  • Another popular variety of rhythms is where the pitch of a note is progressively increased over a short duration before returning to the original pitch and then repeating this cycle over and over again. Katy Perry's I kissed a girl and Calvin Harris's Outside are examples of this type of rhythm pattern.

  • Multiple Notes Rhythm
  • Rhythm patterns we explored till now had notes of few distinct pitch values and in most songs only such distinct pitch values are used throughout the whole song. However a small number of songs use unusually large number of notes with widely different pitch values. Such songs are filled with notes continuously with very little off duration of the notes making them feel more lively, colorful and dynamic. Focus by Ariana Grande and Work by Rihanna are examples of such rhythm pattern.

This concludes the section on visualizing and categorizing rhythm patterns of songs. We now move on to exploring uniqueness of songs, artists, rhythmically most similar song pairs and more.

Uniqueness of a song

Since we now have a method to measure similarity of rhythm in two songs, we can use this to determine the uniqueness of a song. In order to do this, we measure the similarity of a song to every other song in our dataset. The average similarity score of a song to all other songs will determine the uniqueness of a song. Songs which sound similar to most others will have a very high similarity score whereas songs with distinct rhythm patterns will have much lower similarity scores.

The graphic below shows the similarity scores of all the songs used in this project's dataset. The position of the songs on the horizontal axis determines how unique a song is, songs lying more towards right are more similar to other songs in the dataset whereas songs towards left side of the chart possess more unique rhythm patterns.

Rhythm Similarity Scores of Songs

More unique rhythms
Less unique rhythms

Going by this, we observe that our rhythm similarity algorithm declares Lady Gaga's Stupid Love, Pink Floyd's High Hopes, Shawn Mendes's If I can't have you, One Direction's Walking in the wind, David Guetta's This ones for you as the some of the most rhythmically unique songs amongst the songs considered in this project. The top 25 most unique songs are listed in this table below.

Top 25 most unqiue songs

Having seen the most unique songs, we now return to the question we posed at the beginning of this article, that feeling of having heard a similar rhythm elsewhere while listening to a song and if we can determine which are those other songs which possess similar rhythm. The interactive graphic below lets you select a song and see which other songs are rhythmically most similar to it. The similarity scores of the songs pairs are also listed for reference. Scores closer to "1" suggests that the songs have very similar rhythm patterns.

Explore which songs are most similar to some of your favourite songs.

Select a song and see which other songs are rhythmically most similar to it

Most similar songs

Our analysis so far naturally leads to the question of Which are the most rhythmically similar song pairs ? The table below lists the most similar song pairs amongst the songs considered in this project's dataset. The rhythm similarity computation algorithm considers these songs to have extremely similar rhythm patterns. You can inspect the list and ask yourself if you too ever felt like some of these song pairs are similar to each other.

Most Similar Pairs of Songs

Uniqueness of artists

So far we have used our rhythm similarity computation algorithm to analyze uniqueness of songs and to find rhythmically similar songs. However each song has an artist who composed it and accordingly once we have uniqueness scores for songs, we can extend that concept to determine uniqueness of artists. The uniqueness scores of all songs belonging to an artist can be averaged to assign an uniqueness score for an artist. Two types of uniqueness scores can be determined for artists,

  • Inter-Artist uniqueness score
  • This is computed by comparing rhythms in an artist's songs with the rhythms in songs from other artists. This score determines how unique an artist is compared to other artists.

  • Intra-Artist uniqueness score
  • The other way of determining uniqueness is by comparing an artist's songs with other songs belonging to same artist. This score indicates the diversity in an artist's compositions.

The below graphic arranges the artists on the horizontal axis based on their uniqueness scores. Artists lying further to the right have higher similarity score and hence lower uniquenss score. Artists lying towards left are more unique. Use the toggle switch to compare the two scores of artists.

Uniqueness of Artists

Uniqueness score of artists can be computed either by comparing an artist's songs with one's own songs (Intra-Artist) or with those from other artists (Inter-Artist). Toggle switch to compare the two scores

More unique artists
Less unique artists

The Inter-Artist uniqueness score is an indication of whether an artist has tried to replicate similar rhythm patterns of songs from other artists from the past. An artist who has higher uniqueness score (lower similarity) has composed more unique rhythms. Whereas Intra-Artist uniqueness score indicates the uniqueness in an artist's own compositions. A higher uniqueness score (lower similarity) for an artist means that the rhythm patterns in that artist's songs are very different from each other.

Artist Discography

In the final section of this article, let us explore an artist's compositions more closely. The previous section showed the uniqueness scores of artists. Let us now inspect where an artist's songs are positioned on the uniqueness scale. This will help us determine the extent to which different songs contributed to uniqueness score of artist.

The interactive graphic below lets you view all of an artist's songs arranged on uniqueness scale. Further it also lets you visualize the rhythm patterns of all the songs belonging to that artist. Use the toggle switch to alternate between the two modes.

Explore the diversity in an artist's songs
Toggle to see similarity scores of songs or to view rhythm visualisation
More unique rhythms
Less unique rhythms
In the end
(it doesn't even matter),

We started this article with the question of How can we measure similarities in rhythm patterns of two songs ?. The article began by explaining what is rhythm, introducing a new method to visualize rhythm pattern in a song and also presenting a novel algorithm to compute how similar two songs are in terms of their rhythm.

The debate of explore vs exploit is a common theme across multiple domains of life. In terms of song composition, this translates to the question of whether an artist should exploit well known successful rhythm patterns of past and use them in new songs ? Or should the artist explore using entirely new rhythm patterns while composing new songs ? The right answer is like with most things lies in finding the middle ground between the two. Research has shown that people tend to like certain kinds of rhythm patterns more than others. In this regard, it is natural for artists to exploit such popular rhythm patterns over and over. However in order to stand apart in an ultra-competitive world, an artist should also be coming up with new and unique rhythm patterns. This will avoid the artist from being stereotyped into being associated with producing only certain kinds of songs.

As fans of music, we have all had plenty of times when we strongly felt that a song we are listening to sounds eerily similar to another song which we have listened to in the past. However such moments are often closely followed by the feeling of frustration of not being able to pin point which other song it exactly is. The new methodology of finding similarities in rhythm patterns introduced in this article helps us determine precisely that. By assigning rhythm similarity scores to each song pairs, we determined the rhythmically most unique songs, pairs of songs with most similar rhythms. Further by extending the same concept, we assigned uniqueness scores to artists based on how unqiue their songs are.

We can further build on this theory to inspect if using certain kinds of rhythm patterns in songs guarantee any sort of success to the song. Perhaps that question is for another post. As a data scientist, this was a fun exercise to explore rhythm similarities and assign quantitative scores to songs. However we all know that there is so much more to music, it transcends all the math behind it and is often a source of so much joy to listeners. Perhaps in that sense, we should let it be just that and not make it quantitative. Still the next time you listen to a song, observe closely, you may have heard that rhythm before !