How Developers Are Saving the Music Industry from Suing Each Other

Can a Python project with a melody-generating algorithm help fix the copyright system?

Aphinya Dechalert
Mar 9, 2020 · 5 min read

With $41 million in earnings, Katy Perry’s Dark Horse was a mega-hit release and a 2013 windfall for Capitol Records. But in July 2019, the story soured. A jury of nine unanimously found that Dark Horse echoed the little-known 2009 Christian rap song Joyful Noise. And Katy Perry, along with five other co-writers, was found liable for infringing on the song’s copyright.

The price was steep. The judge ordered $2.78 million to be paid in damages, with $550,000 of this coming directly from Katy Perry’s pocket.

Despite the verdict, something still didn’t feel quite right. No one knew how to respond, especially when the suit was essentially over three notes in two songs, played in the same downward progression but in different keys.

The slippery slope of copyrighting melodies

Katy Perry is not the only artist that’s being sued for copyright.

Ed Sheeran is getting a $100 million sting for “Thinking Out Loud” by Ed Townsend’s daughter. The argument? It sounded too much like “Let’s Get It On” — a song that her dad co-wrote and released in 1973. Radiohead went after Lana Del Rey for the closing track in her 2017 Lust for Life album. And at the same time, the Hollies took the opportunity to go after Radiohead.

These cases are only a small representation of what’s going on in the music industry. When a song hits a certain level of success, it often becomes a target for copyright infringement lawsuits.

Marvin Gaye’s family got a payout for Robin Thicke and Pharrell Williams’ “Blurred Lines” in 2015. But the best example of a copyright case gone wrong is probably when the Fantasy Records sued John Fogerty for another song John Fogerty wrote and published with Warner Bros. Record. They argued that the song Forgety wrote for Warner sounded too much like the one he wrote for them. Based on Fantasy Records’ argument, John Forgety was, in essence, breaking copyright by plagiarising himself.

Because that’s what copyright infringement is — an act of plagiarism.

Except if you ever listened to Fogerty’s songs, you’ll have noticed that they all have a particular vibe and tone to them, meaning that the music itself had to abide by certain rules of repetition. It’s the same reason why every pop song nowadays sounds the same, with variations of words here and there.

“Most musicians are working in a finite innovation space. There are not a lot of sounds generally pleasing to people’s ears” — law professor Christopher Buccafusco

What’s interesting is that these cases are presided over by juries who may or may not have any musical knowledge or understanding at all, making the entire exercise unfair by nature. The arguments presented become a minefield of technical terms that are both unfamiliar and complicated for a non-expert to understand.

The logic of algorithms

When it comes to musical notes, there are a limited number of notes available in a typical musical scale — 12 per octave. A standard piano tops out at just 88 notes.

An algorithm is a set of rules for processing a set of data — and what is music but a form of structured data? After all, a musical composition is simply an arrangement of musical notes in a certain order over a certain length, and then repeated in certain areas. While the potential combination of notes may feel infinite, algorithms prove to us that the number of arrangements is actually finite.

For example, mathematically, if we had two notes of equal duration, there are only four possible combinations available:

musical notation combination example for the notes A and C

The number of combinations increases with the number of notes, and as we introduce variables such as rhythm (timing and speed), overlapping notes (as in chord progressions and harmonies), and combinations of instruments (orchestration).

Here’s the problem with a finite melody space and an ever-increasing lineup of potential musical artists. As more and more people create and share their compositions in spaces like SoundCloud, Spotify, and YouTube, someone somewhere is bound to be infringing on each other’s copyright without willful knowledge of doing so.

An open-source project to save future musicians from legal trouble

Damien Riehl is a copyright lawyer by trade. He also happens to be a musician and programmer. With the help of his friend Noah Rubin, they created an algorithm to write every possible melody within the constraints of popular music using Python and Rust. For simplicity, they limited it to a single octave.

Their tool, called All the Music, generated 69 billion potential melodies and saved them on a single hard drive. They could have kept the algorithm going and expanded it beyond 12 notes, except Rubin simply didn’t have the computing power to generate more. While the number sounds large, 69 billion potential melodies is still a finite number. There’s probably a similar number of cat photos posted over the Internet.

Riehl and Rubin made the melodies available to the public under the public domain license. The github repo is available here.

Hacking the copyright system

But how can a melody-generating program help musicians? The trick is in the way that the copyright system works.

By having these generated melodies “uncopyrighted,” Riehl and Rubin are putting them in the public domain. Based on current copyright laws, you cannot bring claims against something that exists as public domain assets. This is because no one technically “‘owns” it and anyone can use it however they want.

What the algorithm essentially does for the music industry is generate all the undiscovered melodies within the pop range and protect them from getting sued on the basis of melodic plagiarism. It shifts the proof of copyright claims to other factors such as direct access, intention, and conscious knowledge.

Is creativity finite?

Music has always been considered as one of the pillars of creativity. With the rise of AI and machine learning, a computer “brain” is much better and more efficient at processing data than a human one.

This raises the question — is creativity just hitting an algorithmic result that hasn’t been brought into a person’s personal awareness? Is everything that’s to be discovered already exists?

Context of discovery and creation is accounted for when it comes to the accidental creation of sameness — something that cases will need to prove in order to draw up a valid legal argument.

Riehl’s open project paves way for discussions about the definition of creativity and how it’s currently being protected by the law. If a computer can generate a series of notes before another musician does, should it count? Some commercial entities will probably want to have their arrangements copyrighted for protection of monetization, but what does this project mean for their commercialization aspects in the future?

Whatever the outcome is for this discussion, it took a developer, his friend, and a bit of Python scripting to start unraveling the slippery slope of copyright suits that are currently happening within the music industry.

Young Coder

Insights in .NET, JavaScript, and future tech

Aphinya Dechalert

Written by

React. JavaScript. Angular. Firebase. ☕🍕☕🍕☕🍕 Follow me at to get notified about my latest articles & antics on and off Medium.

Young Coder

Insights into the .NET stack. Thought pieces about the craft of software development. Real advice for teaching kids to code. And a shot of humor.

Aphinya Dechalert

Written by

React. JavaScript. Angular. Firebase. ☕🍕☕🍕☕🍕 Follow me at to get notified about my latest articles & antics on and off Medium.

Young Coder

Insights into the .NET stack. Thought pieces about the craft of software development. Real advice for teaching kids to code. And a shot of humor.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

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