Do computers know what music genres are?

There’s more to genres than can be captured by an algorithm.

Image for post
Image for post

Music genres are hard to define. They have something to do with sorting music by rhythm, melody, tempo, tonality, or instrumentation, but it’s more than that. Genres are also based on historic and social concepts. When was the music written? Which country is it from? In what setting is it usually performed and how does the audience interact with it? Is this music to quietly listen to from the plush seats of a concert hall, or is this music to dance to at a crowded all-night rave in an abandoned warehouse?

There are conventions and norms associated with certain types of music that aren’t easily identifiable from the music itself. Two pieces of music with a very similar musical structure might fall in completely different genres.

Chord progressions defy genres

For example, while jazz music has distinguishable chord progression rules, pop, rock and classical music all use pretty much the same rules. There are some chord progressions that are so persistently used throughout the ages that they have become a bit of running joke. A 2006 YouTube video by comedian Rob Paravonian shows him performing his “Pachelbel Rant”, in which he points out music that uses the exact same chord progression as Pachelbel’s Canon in D, across genres as diverse as folk, pop, rock and punk.

So, when a group of Spanish computer scientists wrote an algorithm to sort music by chord progressions alone, they weren’t able to clearly distinguish between pop music and classical styles (including baroque or romantic music). Their algorithm could tell the difference between jazz and other genres, though, because jazz music is partly defined by a different set of chord progression rules.

MIDI files — music for computers

To sort music by chord progressions, the researchers analysed the pitch class profiles of MIDI files. This file format includes a lot of information about the music: It contains details about tempo, pitch, volume, and other things that can be interpreted by computer programmes.

If chord progression isn’t enough to recognize different music genres, is there another way that computers might be able to sort music by genre? That’s a challenge that computer scientists have been working on for a long time. They all start the same way — with a collection of MIDI files of musical pieces from different genres. Then they try to find patterns in these digital profiles that correspond to certain music styles.

Tonality

In December, a group of researchers used MIDI files to study the way that tonality evolved in Western music between the Middle Ages and the 20th century. They looked at 24,000 songs from this period and started to see some patterns. They confirmed that most of the music in the set followed the traditional rules of Western music, such as the Circle of Fifths.

But there were differences, too. Over time, certain patterns fell out of style or became more fashionable. They found groups within the data that roughly corresponded with some known genres. It wasn’t perfect. The system didn’t consider any other factor than tonality, so it grouped together composers from different eras that happened to follow similar composition rules and patterns, even though genres are also determined by time periods. And because the only criteria was tonality, noted atonal composer Schoenberg was all by himself in a group. Poor Schoenberg: Even computers think his music is strange.

Entropy

Looking at a single factor such as chord progression or tonality doesn’t seem to be quite enough to define a genre. A few years ago, researchers in Venezuela found a different way to analyse MIDI files. They didn’t just isolate information that a musician might understand (like chord progressions) but they considered the entire collection of digital information stored in the MIDI file and compressed it into the smallest possible set of symbols that still represented all the information of the piece. Then they looked at the entropy — the variety of ways the information could be interpreted — and created a profile of the diversity of the patterns they found.

Within known music genres, most pieces had very similar entropy profiles, and this method was pretty good at distinguishing traditional music from pop music, or medieval music from more recent music. But this wasn’t perfect either. Baroque and rock music still looked very similar, and Chinese music had similar profiles as Impressionistic music.

All the stuff that’s not in MIDI files

MIDI files contain a lot of information. Anything in there can be read by computers and used to group music into different sets. So far, none of these attempts have been able to capture the exact genres of music that we defined as humans. Maybe they never will, because a lot of relevant information is not in MIDI files at all.

Image for post
Image for post

A MIDI file can’t tell you which music award category a musician is usually nominated in, what festivals they play, which other music their fans listen to, how the musicians categorize themselves, or what subcultures their music is associated with. Music can be reduced to mathematical components, but we experience it as much more than that.

To fully understand music genres, a computer needs more than MIDI files. For example, it could include behavioural data. Some music recommendation services group music based on how many other users all listen to this same combination of musicians, and combine that information with user-generated tags or the categories provided by record labels. They don’t try to identify genres. They just formulate how people interact with music. It’s still not a flawless system, but it could bring computer algorithms another step closer to understanding what a genre is.

Do humans know what music genres are?

If computers do eventually learn how to pigeonhole music into genres, they will be one step ahead of humans, because we don’t even really know how to unambiguously do this ourselves. Musicians, fans, and music critics may all have a different idea about which genre an artist or their work falls under — or create new genres on the fly. There are sub-genres, local genres, and fusions, all determined by a combination of the music itself and the people who interact with it. Good luck figuring it out, computers.

Writer, science communicator, musician. Find more of my writing at Forbes.com, Undark, Nature, Nautilus, The Scientist, Hakai and other places.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store