Music Tempo Throughout the Ages

How did our popular music tempo evolve from 1920s onward?

Sumit Tripathi
6 min readOct 27, 2023

I love listening to different types of songs from classical, jazz to pop, especially if the tune is catchy enough. The rhythm and the lyrics of memorable songs just beg you to stay in the moment, enjoy, and even lift you up!

For some time, I wanted to study how the tempo of songs have changed throughout the eras. We can feel that the music have changed dramatically throughout the ages, but I can only able to tell it from experience. Wouldn’t it be interesting to see how things progress incrementally year by year analytically?

This is where I found that Spotify has the API service that lets you analyse the songs data. For more info, read this article to get you started for the Spotify PI and its different parameters that you can use: Spotify API

After getting the API key. I add the API keys to the Python code as follows:

import requests

# Set your Spotify API credentials
client_id = 'YOUR_API_ID' # Add your API ID in the ''
client_secret = 'YOUR_API_KEY' # Add your API KEY in the ''

# Authenticate and get an access token
auth_url = 'https://accounts.spotify.com/api/token'
auth_data = {
'grant_type': 'client_credentials',
'client_id': client_id,
'client_secret': client_secret,
}

auth_response = requests.post(auth_url, data=auth_data)
auth_data = auth_response.json()
access_token = auth_data['access_token']

# Define the range of years you want to analyze
start_year = 1920
end_year = 2022

# Create a dictionary to store tempo data by year
tempo_data = {}

# Loop through the years
for year in range(start_year, end_year + 1):
# Define your search query to fetch only the top 20 tracks for the current year
search_query = f'year:{year}'
limit = 20 # Limit the number of top tracks to 20

# Make a GET request to the Spotify Web API to fetch tracks for the current year
search_url = 'https://api.spotify.com/v1/search'
headers = {'Authorization': f'Bearer {access_token}'}
params = {
'q': search_query,
'type': 'track',
'limit': limit,
}

search_response = requests.get(search_url, headers=headers, params=params)

if search_response.status_code == 200:
search_results = search_response.json()

# Store tempos for tracks of the current year
tempos = []

# Select tracks with a popularity index above 90, if available
top_tracks = [track for track in search_results['tracks']['items'] if track['popularity'] > 90]
if not top_tracks:
# If there are no tracks with popularity above 90, use the top tracks
top_tracks = search_results['tracks']['items']

for track in top_tracks:
# Now, fetch audio features
audio_features_url = f'https://api.spotify.com/v1/audio-features/{track["id"]}'
audio_response = requests.get(audio_features_url, headers=headers)

if audio_response.status_code == 200:
audio_features = audio_response.json()
tempo = audio_features['tempo']
tempos.append(tempo)

# Calculate the average tempo for the current year and store it in the tempo_data dictionary
if tempos:
average_tempo = sum(tempos) / len(tempos)
tempo_data[year] = average_tempo
else:
print(f"Error fetching tracks for year {year}: {search_response.status_code}")

# Print the aggregated data
for year, average_tempo in tempo_data.items():
print(f"Year: {year}, Average Tempo (BPM): {average_tempo}")

From here, I want to get the list of top 20 tracks in each year and then calculate the average tempo.

Here is the result:

Year: 1920, Average Tempo (BPM): 112.54599999999998
Year: 1921, Average Tempo (BPM): 130.58999999999997
Year: 1922, Average Tempo (BPM): 95.98604999999999
Year: 1923, Average Tempo (BPM): 103.34674999999997
Year: 1924, Average Tempo (BPM): 99.6739
Year: 1925, Average Tempo (BPM): 127.97819999999999
Year: 1926, Average Tempo (BPM): 125.60985000000002
Year: 1927, Average Tempo (BPM): 124.13539999999998
Year: 1928, Average Tempo (BPM): 125.61785
Year: 1929, Average Tempo (BPM): 117.04375
Year: 1930, Average Tempo (BPM): 118.93320000000001
Year: 1931, Average Tempo (BPM): 127.46799999999996
Year: 1932, Average Tempo (BPM): 121.76695
Year: 1933, Average Tempo (BPM): 108.02765
Year: 1934, Average Tempo (BPM): 122.81485
Year: 1935, Average Tempo (BPM): 119.47965000000002
Year: 1936, Average Tempo (BPM): 120.42774999999999
Year: 1937, Average Tempo (BPM): 108.34250000000002
Year: 1938, Average Tempo (BPM): 115.36609999999999
Year: 1939, Average Tempo (BPM): 118.1558
Year: 1940, Average Tempo (BPM): 115.54880000000003
Year: 1941, Average Tempo (BPM): 110.3104
Year: 1942, Average Tempo (BPM): 118.75364999999996
Year: 1943, Average Tempo (BPM): 104.4413
Year: 1944, Average Tempo (BPM): 126.62804999999999
Year: 1945, Average Tempo (BPM): 107.89085
Year: 1946, Average Tempo (BPM): 110.1807
Year: 1947, Average Tempo (BPM): 123.77645
Year: 1948, Average Tempo (BPM): 123.46495
Year: 1949, Average Tempo (BPM): 109.75610000000002
Year: 1950, Average Tempo (BPM): 116.93385
Year: 1951, Average Tempo (BPM): 119.70259999999999
Year: 1952, Average Tempo (BPM): 99.46449999999999
Year: 1953, Average Tempo (BPM): 127.56060000000002
Year: 1954, Average Tempo (BPM): 117.59369999999998
Year: 1955, Average Tempo (BPM): 124.20215
Year: 1956, Average Tempo (BPM): 101.32879999999997
Year: 1957, Average Tempo (BPM): 124.5771
Year: 1958, Average Tempo (BPM): 127.15329999999999
Year: 1959, Average Tempo (BPM): 109.6663
Year: 1960, Average Tempo (BPM): 117.90325000000003
Year: 1961, Average Tempo (BPM): 106.5403
Year: 1962, Average Tempo (BPM): 124.65870000000002
Year: 1963, Average Tempo (BPM): 122.91024999999999
Year: 1964, Average Tempo (BPM): 123.48194999999998
Year: 1965, Average Tempo (BPM): 120.48384999999999
Year: 1966, Average Tempo (BPM): 114.43814999999995
Year: 1967, Average Tempo (BPM): 122.33095
Year: 1968, Average Tempo (BPM): 109.64259999999999
Year: 1969, Average Tempo (BPM): 126.56070000000003
Year: 1970, Average Tempo (BPM): 122.54244999999999
Year: 1971, Average Tempo (BPM): 118.12360000000001
Year: 1972, Average Tempo (BPM): 114.80864999999999
Year: 1973, Average Tempo (BPM): 124.9624
Year: 1974, Average Tempo (BPM): 126.02440000000001
Year: 1975, Average Tempo (BPM): 131.89265
Year: 1976, Average Tempo (BPM): 121.22210000000003
Year: 1977, Average Tempo (BPM): 121.0069
Year: 1978, Average Tempo (BPM): 117.06500000000001
Year: 1979, Average Tempo (BPM): 125.56855
Year: 1980, Average Tempo (BPM): 130.90775000000002
Year: 1981, Average Tempo (BPM): 120.3172
Year: 1982, Average Tempo (BPM): 116.13384999999998
Year: 1983, Average Tempo (BPM): 122.37315000000001
Year: 1984, Average Tempo (BPM): 124.20169999999999
Year: 1985, Average Tempo (BPM): 117.32735
Year: 1986, Average Tempo (BPM): 126.13510000000001
Year: 1987, Average Tempo (BPM): 111.35459999999998
Year: 1988, Average Tempo (BPM): 118.67819999999999
Year: 1989, Average Tempo (BPM): 119.80580000000002
Year: 1990, Average Tempo (BPM): 110.14035000000001
Year: 1991, Average Tempo (BPM): 109.9535
Year: 1992, Average Tempo (BPM): 126.671
Year: 1993, Average Tempo (BPM): 119.69785000000002
Year: 1994, Average Tempo (BPM): 121.36120000000001
Year: 1995, Average Tempo (BPM): 113.96784999999997
Year: 1996, Average Tempo (BPM): 113.45385000000002
Year: 1997, Average Tempo (BPM): 108.32485
Year: 1998, Average Tempo (BPM): 108.36280000000002
Year: 1999, Average Tempo (BPM): 112.89314999999999
Year: 2000, Average Tempo (BPM): 173.372
Year: 2001, Average Tempo (BPM): 125.2216
Year: 2002, Average Tempo (BPM): 126.34429999999998
Year: 2003, Average Tempo (BPM): 109.9636
Year: 2004, Average Tempo (BPM): 122.0932
Year: 2005, Average Tempo (BPM): 127.47060000000002
Year: 2006, Average Tempo (BPM): 117.19220000000003
Year: 2007, Average Tempo (BPM): 127.36960000000002
Year: 2008, Average Tempo (BPM): 127.63834999999999
Year: 2009, Average Tempo (BPM): 135.1616
Year: 2010, Average Tempo (BPM): 116.9908
Year: 2011, Average Tempo (BPM): 120.41764999999998
Year: 2012, Average Tempo (BPM): 105.84580000000001
Year: 2013, Average Tempo (BPM): 95.79050000000001
Year: 2014, Average Tempo (BPM): 117.42195
Year: 2015, Average Tempo (BPM): 108.90050000000001
Year: 2016, Average Tempo (BPM): 172.9715
Year: 2017, Average Tempo (BPM): 71.49166666666667
Year: 2018, Average Tempo (BPM): 121.37050000000002
Year: 2019, Average Tempo (BPM): 119.26400000000001
Year: 2020, Average Tempo (BPM): 97.74374999999999
Year: 2021, Average Tempo (BPM): 138.40199999999996
Year: 2022, Average Tempo (BPM): 120.17519999999999
This is just the sample results of the top 20 songs with popularity score > 90 in each year. The result could vary further once we add more data points.

I imagined the song tempo in the olden days to be much more slower and that we would slowly be progressing to a much faster tempo as the technology booms. But seems like that trend is not very clear yet because we are only able to sample 20 songs from each year and the data is still a bit noisy for some years (Spotify’s free API has some kinds of limits that make it hard to get more data).

Still, it is quite interesting to see the average tempo still hover around 120 BPM. And I am not fully certain whether there could be any potential linkages between the major events in a particular year. But it would be interesting to check this once we get a more data points.

Note: I wanted to map this data from the Baroque period onward, but it is quite a challenge to map the composition by year since Spotify API does not provide this data. Most classical songs on Spotify indicate the album recording year as the main data point and do not always offer the composition year as the data point since it could be difficult to pinpoint.

Nonetheless, this kind of data could have the potential to help us understand the popular songs’ tempo that people prefer in each year. And better understand that historical period better through music studies. We could also apply this similar approach to other data points like the loudness, rhythm, key signature, and then analyse the trends further as well.

I hope that this will help us understand music a bit more through the lens of analytics and that this would pique some interests to explore or even create new style of music that would usher a new musical age to come.

Happy exploring!

--

--