The Atlantic

In an era when millions of songwriters upload music to the internet—and just about any song can be plucked from obscurity by TikTok teens—it seems inevitable that the same melodies end up in different songs. There have been a number of high-profile music copyright-infringement cases, including a multimillion-dollar decision against Katy Perry for her song “Dark Horse.” A jury found that she’d infringed upon the copyright of Flame, a Christian rapper who’d posted a song with the same melody to YouTube, even though Perry insisted that she’d never heard of the song or the rapper. For some musicians, musicologists, and lawyers, the verdict felt scary; after all, large numbers of songs now live on SoundCloud and YouTube. It became thinkable to ask: Could the world run out of original melodies?

Damien Riehl and Noah Rubin were two of those worried musicians. Riehl is a lawyer who has worked on copyright. Rubin is a coder. They were hanging out after a long day at work when a “a lark, a thought experiment” occurred to Riehl: Maybe they could exhaust all possible melodies—and in so doing, protect musicians from being sued for copying songs they don’t remember hearing.

On the one hand, they can’t really create them all. A melody, simply put, is a sequence of notes. If you’re talking about all the notes and all the traditions of music around the world, the combinatorics yields functionally infinite possibilities for the melodies that result. Take just the 88 notes on a piano and, for instance, 12-note sequences. You get 216 sextillion melodies. And of course, that’s only within the Western tradition, in which these particular frequency ranges are considered notes.

On the other hand, if we’re talking practically about Western popular music in the range in which hit songs are made, that is already a radically restricted domain. And within it, the number of melodies is in a more comprehensible part of finitude. Popular music tends to use a more limited range of notes than an entire piano. And Riehl and Rubin figured that most pop melodies run fewer than 12 notes. If you generated every possible melody with just the eight notes of the C scale, that’d be 8^12 melodies, which is 68,719,476,736. That’s a big but thinkable number, considering that SoundCloud receives tens of millions of uploads a year.

Riehl and Rubin hatched a plot to create software that would write every melody, at least within this popular range. It wouldn’t be unlike dialing every possible telephone number: 111-111-1111, 111-111-1112, 111-111-1113, and so on: do-do-do-do-do-do-do-do-do-do-do-do, do-do-do-do-do-do-do-do-do-do-do-re.

As it turns out, there were considerable complications to even writing 68 billion melodies within the team’s existing hardware, which amounted to Rubin’s computer. “It is true that the set of all melodies is finite. But finite is still large,” Rubin told me. “It’s quite large, with the current computing technology that we had access to. We’re not Amazon.”

The duo built a simple system working with MIDI, the computer music framework, and started outputting melodies. They’d wanted to generate all possible melodies on the piano, but after some prototyping, settled for 12-note melodies in a popular range that Riehl had seen implicated in copyright litigation: the octave ascending from middle C. Even to complete this set, Rubin had to switch programming languages (from Python to Rust), he said, “and that gave us the speed increase we needed.” Soon, they had a hard drive filled with almost 69 billion melodies. In a conversation with Adam Neely, a YouTuber who helped spread the word about the project, Riehl alluded to previous copyright thought experiments. “This has been a concept that has been discussed,” he said. “But no one has ever brute-forced [it] in this way.”

Now Riehl and Rubin want to release the fruits of that brute-forcing into the public domain. They figure that in a future suit where a musician is hit with copyright infringement, she could point back to the melody on that hard drive as her uncopyrighted inspiration. Their point, ultimately, is that melodies could be seen as math, which is to say facts, and facts cannot be copyrighted. This is not to say that songs cannot be copyrighted, but that each possible series of notes is not a creation so much as a selection from a fairly limited set. (Information theorists might add that selection from a set of possibilities is the very nature of all information—but that’s beyond the theoretical scope of the melody project.)

Riehl and Rubin’s work is provocative on several levels. One, it raises some of the same issues about originality that haunt many discussions of creativity. A recent 99 Percent Invisible podcast episode about the song “Who Let the Dogs Out” provided an especially evocative example of the possibility of unintentional duplication. Ben Sisto, an artist who spent a decade tracing the origins of the woof-woof-woof hook, found variation after variation of that horrible song throughout musical history, some seemingly connected by a chain of transmission, others not at all. “One of the big myths we tell ourselves about art is that it is made by individuals, and that myth is what the art market is propped up on,” Sisto told the show’s hosts. He’s come to believe instead that it is impossible to reliably distinguish what people invent from what they borrow. “I think that all these ideas apply to every piece of creative work ever made,” Sisto concluded in the episode. “It’s just about the very nature of art and life.”

On another level, the melody project asks some interesting questions about machine creation. Is writing some software to output MIDI melodies to a hard drive the same as if you’d created the song, played it on your xylophone, and uploaded it to SoundCloud? Did Riehl and Rubin free music from restriction, or did they infringe on millions of copyrights?

At the very least, the work highlights the long-standing flaws of the current music-copyright system. But legal experts were decidedly less enthusiastic about whether it would actually help musicians in a live-fire copyright case.

“I just don’t get it,” Lawrence Lessig, an eminent copyright scholar at Harvard Law School, told me in an email. “Whether or not melodies can be represented in math, they are not just math. So that seems like a dead end.”

Lessig did agree that it’s unfair that anyone can be dinged for “copying” work even if they could not be shown to have consciously done so. “The whole doctrine of subconscious copying is absurd. So I get the motivation,” he said.

Kristelia García, a law professor at the University of Colorado, saw things in mostly the same way. “It’s an interesting thought experiment,” she told me in an email. “And I think it does a good job of exposing the absurd point we’ve reached in music copyright infringement.” But she didn’t think the project could prevent copyright-infringement suits over melodies. “I am not at all convinced it does what they hope it will do (i.e., give artists a free pass out of infringement suits) since so many of their melodies are almost certainly already ‘owned’ by someone else,” she said.

Undaunted by the somewhat chilly responses from copyright lawyers, Riehl and Rubin are expanding their range of notes and starting to account for rhythm. Ultimately, Riehl hopes that legislation, not coding projects, can reform how copyright works in the United States. He would not want to see their melody project adjudicated in court. “A better place to do it is in Congress, to modify the copyright law in a way that makes sense,” he said.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.