This week, Ed Sheeran, a pop star whose stranglehold on the UK Top 40 is so extreme that his Star Wars name would be Chart Maul, avoided a lengthy legal trial by settling a $20m (£16m) copyright infringement claim out of court, for an unspecified sum. Two writers behind Amazing, a song by X Factor hat-botherer Matt Cardle, had spotted something familiar in Sheeran’s song Photograph and, represented by the legal team who annihilated Robin Thicke and Pharrell Williams in the controversial Blurred Lines case, filed a lawsuit.

This settlement comes two weeks after the writers of TLC’s No Scrubs were suddenly added to the credits of Sheeran’s Shape of You (the precise circumstances of that addition are unknown, but it is fair to speculate that Sheeran didn’t just do it for a laugh) and it follows a claim last year – apparently ongoing – that Sheeran’s Thinking Out Loud copied Marvin Gaye’s Let’s Get It On.

It is not just about Sheeran. Whether it is Mark Ronson adding Oops Upside Your Head’s writers to Uptown Funk or a shift in the law allowing for a case against Led Zeppelin’s Stairway to Heaven (which the band won), alleged musical kleptomania seems more heavily patrolled than ever. There are many questions here. Are songwriters increasingly lazy, or arrogant, or simply incompetent – or are they being unfairly chastised for a warm homage to the music they, and we, grew up with? Is plagiarism itself on the increase or are ambulance-chasing legal teams becoming more aware that many artists will quietly settle out of court to avoid public legal proceedings? And after 70 years of this thing we call pop, are the chances of writing something brand new mathematically fewer?

Facebook Twitter Pinterest Led Zeppelin won a case against them over Stairway to Heaven. Photograph: Alamy

Such questions sit heavily on the shoulders of those who work in and around music. “Oh, God,” is the initial response from one major label A&R, who wisely asks not to be identified. “We’ve been burned in the past and we’re really aware that songs can’t get too close to other ones. It makes artists look bad. We try to spot problems quickly now. We’re so scared, because of the things that have happened recently. There have been several occasions where we’re like: ‘Hold on, this song is actually that song.’”

When that happens, they will call in a musicologist – but until it is possible to wire your brain into the Spotify database, there is a catch. “We’ll say: ‘This song is similar to another one. Is it too similar and what do we need to change?’ But to go to him in the first place, we need to have already spotted which song the new song sounds like.”

One such musicologist – a forensic musicologist, in fact, and don’t pretend you wouldn’t like that on your business card – is Joe Bennett. Does he agree with the hypothesis that pop might be running out of tunes?

“In cases of melody-based plagiarism disputes,” Bennett says, “melodic probability can be used to ask: ‘How likely are two melodies to come out identically, or very similarly, through coincidence?’ A lot of people assume that identical melodies could be independently generated by separate songwriters, but you don’t need to get very deep into the maths to see why that wouldn’t be true.”

Bennett then goes very deep into the maths, proposing a scenario where he and I each decide to write a melody. “I might start on C and you might start on E – two of the seven notes in the major scale. The odds [against us choosing the same note] aren’t exactly one in seven, but you get the idea. Then you come to the second note: I might choose D, you might choose another E. So then we’ve got a seven to the power of two probability, and that’s just within two pitch choices.”

Bennett then imagines a “3D maths puzzle” that combines pitch choices with other multipliers such as rhythmic placement (“which of eight possible placements in the bar might you choose?”) and harmonic context – the chords played underneath the note. “Not all melodic choices are equally pleasing, and there are pitch choices songwriters would naturally avoid, but the fact remains that when you multiply those variables up over any length of note chain – four, five, six notes – you’re into some pretty astronomical numbers,” says Bennett.

“In the case of Sheeran’s Photograph, there’s a 16-bar sequence where the majority of pitches, the majority of rhythmic placements and almost all the harmonic context is the same as the equivalent section of Amazing – there are 39 identical notes. The chance of that happening coincidentally and independently is almost zero. If I hear two songs where melodies are identical in pitch and rhythmic placement, over a few bars of music, my initial reaction is that it’s pretty likely there will be some element of copying. Whether that’s plagiarism becomes a legal question.”

And, yes, there’s a difference between copying and plagiarism. If someone decides to sue Sheeran, but Sheeran can prove that the complainant’s song was itself based on something else, the case could fall apart. “When I consult on alleged plagiarism,” Bennett says, “I’ll often go back and see if the first songwriter used a melody that already existed – something out of copyright, like a Mozart tune. It sounds like sleight of hand, or a trick, but it’s absolutely true that if the melody pre-existed, then any later identical melody would by definition not be original.”

Facebook Twitter Pinterest The opening bars of One Direction’s Best Song Ever were similar to a song by the Who. Photograph: Ian West/PA

Over to Pete Townshend who, asked about One Direction’s Best Song Ever, whose opening bars were similar to the Who’s Baba O’Riley, released a statement saying: “The chords I used and the chords they used are the same three chords we’ve all been using in basic pop music since Buddy Holly, Eddie Cochran and Chuck Berry made it clear that fancy chords don’t mean great music – not always. I’m still writing songs that sound like Baba O’Riley – or I’m trying to.”

All self-aware creatives are plagued, from time to time, by the idea that their ideas may not be original. Inadvertent plagiarism, or mistaking a memory for a new idea, even has a name – cryptomnesia – and it is a rare songwriter who has not at least once put the triumphant finishing touches to a surefire smash, only to realise they have just ripped off a multi-platinum hit. (Many more have surely not realised, that they have ripped off a minor flop.) I was once given an early playback of a global artist’s new album and spotted a possible infringement in one chorus. Suspecting the artist would react badly if I piped up, I fed the information back through their publicist, and by the time the album came out that song’s chorus melody had changed. Similarly, one songwriter I speak to recalls a recent incident that was caught before a song was released.

“I worked with a singer last year,” begins a songwriter I speak to. “There’s a certain melodic style – it pops up on tracks by Halsey, Jeremih and Ariana Grande – and we used something similar on this track. We were like: ‘This is brilliant!’ Job done for the day. The next week I was out in a cafe and a song came on with our exact melody. As a younger writer, she possibly didn’t know what she’d done, but I knew we’d accidentally ripped off a song. By that point we’d only sent the song to our publishers, where nobody had spotted it, by the way, but we had to get it back and rewrite the section.”

The problem in that case was that the song’s melodies – the notes you would see on sheet music – were identical. But we all hear songs on the radio that we decide have “ripped off” others in a way we can comprehend: quite simply, they sound similar. And we decide it is not an accident. We decide they are clearly, cynically, the result of someone listening to someone else’s song and deciding to remake it. Which does happen. But while you and I may think that Let’s Get It On and Thinking Out Loud are similar, Bennett deems that accusation of plagiarism unfair. Morally, we might call it naughty-step behaviour; legally, it is fine.

This was not the case, however, when it came to Blurred Lines. Significantly, this civil suit involved a jury trial and an “intrinsic” (or “lay listener”) test, relying on the verdict of standard punters rather than a musically aware judge. Thicke and Williams attempted to explain that “vibe” can’t be copyrighted, but one controversial upshot of the case was that copying the “feel” and “sound” of another song – rather than infringing on historically copyrightable elements – can now be seen as grounds for a massive legal hullabaloo. An extreme example: what would happen if Motown suddenly decided its “sound” was copyrightable? It wouldn’t be looking good for Olly Murs, let’s put it that way.

Many saw the Blurred Lines case as the pop equivalent of the bit in Ghostbusters where the containment unit is shut off and all hell literally breaks loose; more than 200 massive songwriters filed a letter with the ninth circuit court of appeals expressing their anxiety about how future creativity would be stifled. The case certainly puts a different spin on the “who’s looking” lists that songwriters and producers regularly receive. These tip sheets, where new artists and household names are united in the common pursuit of hit material, are in equal parts fascinating and bleak. You will see phrases such as “looking for edgy tracks” (Annie Mac keeps saying no), “seeks topline for next single” (the single doesn’t actually have a song bit yet), “looking for great sessions” (about to be dropped) and “open for selective co-writes” (will do anything for a hit). Sometimes, briefs are less vague. “Looking for tracks in the style of JLS meets Boyz II Men” was a phrase on one list from a few years ago. Elsewhere, the list was more specific. “Reference track is Blu Cantrell Hit ’Em Up,” stated the listing for one talent show contestant. Another listing for a girlband was so specific that it included YouTube links to three existing songs for reference.

In the post-Blurred Lines era, that list could be seen as the smokiest of all smoking guns – not to a musicologist, but maybe to juries of normal people, and juries are a fact of life in the US, where most of these cases are tried. One case involving Justin Bieber is a good example of how ears can be deceived. Last year, indie artist White Hinterland threw a lawsuit at the team behind Justin Bieber’s enormobanger Sorry claiming that her song Ring The Bell had been used on the track. To the untrained ear, the similarity was strong. Even Diplo, who has got pretty good ears, went on record saying he thought it was a sample. Then Skrillex uploaded a video showing how he had created the hook by manipulating an ad-lib from the song’s original vocal, by songwriter Julia Michaels. The video was captioned: “SORRY but we didn’t steal this.”

But for Michaels, who has also written for Britney, Gwen Stefani and Selena Gomez, that wasn’t the end of the story. What happened next shows how unexpectedly lawsuits can play out: you might assume a potential plagiarist would get all the negative feedback, but that doesn’t account for the defensive nature of several million Beliebers. “Sonny [Skrillex] said to me, post the video [on social media] if you want, it’s your fight as much as it is mine,” Julia told me last year. “I posted it, and people thought it was me who was suing everybody! People don’t ever look up the songwriters on a song, they automatically assume the artist has written everything themselves. I got a lot of hate comments: go kill yourself, why would he [Justin] want to steal from you, you’re a piece of shit, you’re nothing. It’s insane. I’m like: ‘GUYS. I’m a very honest person. Guys, like, REALLY.’”

Interestingly, Bennett goes so far as to suggest that plagiarism could be considered a defensible part of the songwriting process. “It’s a legitimate part of composition,” he states. “You’re creating something that sounds good, while discarding all the ideas you’ve heard before. You might see sculpture as the ultimate metaphor for subtractive creativity; Michelangelo said that every block of stone has a statue inside it and it is the task of the sculptor to discover it.”

Surely, in that case, it must have been easier for the Beatles? Obviously, they had a knack for a decent tune, but they didn’t have the spectre of 70 years’ worth of popular song looming over every writing session. “Well, I don’t buy that personally,” Bennett says. “Yes, there’s been a lot of pop since the Beatles, but one might say there was more music before. People have been making music for thousands of years. I do believe pop behaves evolutionarily and passes on its ideas to the next generation, but I don’t think that makes it any less likely that songwriters will continue to write original cool pop melodies for ever.”

Not everyone is so sure, however. Someone who does at least partially back up the theory that pop is running out of songs is Radio 1 DJ Scott Mills. “We do this silly feature where the idea is: ‘Radio 1 needs to be worried because we’re a new music station and we’re actually running out of music,’” he says. The feature involves playing similar songs side by side. “Our premise is like yours: surely there are only so many notes, melodies and combinations?”

Facebook Twitter Pinterest Little Mix’s Shout Out to My Ex resembled GRL’s Ugly Heart.

The feature started when Little Mix unveiled Shout Out to My Ex, a song whose resemblance to US girlband GRL’s Ugly Heart wasn’t lost on fans of either band, or indeed on GRL, who swiftly tweeted the rather pointed hashtag #shoutouttouglyheart. “Obviously we’re very careful,” Mills adds, “and we say: ‘Ooh, they are a bit similar BUT THEY’RE OBVIOUSLY NOT THE SAME.’ My favourite was when we played the BBC’s One Show theme, which we’d noticed had the same trumpet as [late-90s electro jazz monstrosity] Would You …? by Touch And Go. Then we found out why: they were written by the same guy!”

Drawing on his own experience, Mills is sympathetic towards the idea of inadvertent plagiarism. “I think about that all the time. Like, I come up with totally original ideas for regular features on the show and then I’ll realise, generally, that I’ve just remembered an old gameshow like Blankety Blank. If you’re a songwriter, your brain works in a different way when you hear music, you soak it all up like a sponge, and you’ll 100% believe a song is yours. But I very rarely think people are plagiarising on purpose. I mean, why would you? In a world where everyone sues each other all the time, why bother?”

It’s a line of argument supported – from the perspective of mathematical probability – by Bennett. “Why would you plagiarise,” he asks, “when it’s easier to write an original song?”

For artists and songwriters that’s the million-dollar question – probably less, if you settle out of court.