Does music help you to run faster?

'Music is a legal drug for athletes," claims Dr Costas Karageorghis, an expert on the effects of music on exercise, at Brunel University. In his latest book, Inside Sport Psychology, he claims that listening to music while running can boost performance by up to 15%.

If this is true, then the Rock'n'Roll marathon series is on to something. The events, a fixture in the US for almost 15 years, are extremely popular, with 450,000 people running in one of its 2012 races alone. Many other big city races have the occasional band along the route, and London has had the Run to the Beat half-marathon, lined with DJs, for the past five years. But on 15 April the UK finally got its first taste of the action, with the inaugural Edinburgh Rock'n'Roll half-marathon.

As I lined up at the start with almost 4,000 other runners, we were serenaded by Edinburgh's Got Talent winner Caitlyn Vanbeck. With Arthur's Seat towering above us, it was stirring stuff, and may explain why I shot off at the front, following the lead car around the first few bends.

After spending six months training in Kenya last year, I have become something of a serious runner, and finished eighth. This is important because, according to Karageorghis, the benefits of listening to music decrease with the level of intensity of the running. The faster you run, he explains, the less effect the music has.

"Elite athletes," says Karageorghis, "are usually 'associators', which means they tend to focus inwardly when they are running." Most other runners, he says, are "dissociators" (or are somewhere between the two). This means they look for stimulus and distraction from what is going on around them. "Judging by your times," he says, "you are probably an associator."

It is true. Apart from Vanbeck's rousing Flower of Scotland at the start, when I was standing still, afterwards I can barely remember the music played along the course. The first act I passed, folk group the Deadly Winters, made me smile, and at one point I found myself running in synchronicity with the beat of a heavy-rock combo. But they were moments that came and went in a flash. I can't say they helped my performance very much. But what did other runners make of it?

Adam Bull, from Leeds, had run the Hull marathon the week before with no music and little crowd support. "The music today made a big difference," he said. "At the upbeat bands, you find yourself running to the beat, which helps. The music also brings out the crowds." Bull was already a fan of the Rock'n'Roll series, travelling to Las Vegas to take part in one. How did Edinburgh compare? "Edinburgh was just as good. In fact, I think there were more bands here. But in Las Vegas there was a mass wedding ceremony in the middle of the race."

Rosie Bradford, from Barnard Castle in County Durham, is also a convert. "As we ran past the band at mile three and they started playing These Boots Were Made for Walking, everybody suddenly went faster."

The only person I found who was less than happy with the music was Lois Lloyd, from Liverpool, who ran in an Oktoberfest outfit. "There wasn't enough of it, and it wasn't loud enough," she said. "I ran without my iPod for the first time ever, and I really missed the music."

Karageorghis is not surprised when I tell him. "There are many advantages to using an iPod, rather than relying on the music on the course," he says. "It gives you a constant stimulus, rather than just an occasional one, while you can tailor the playlist to your taste."

One runner told me there was a direct correlation between the quality of the music on the course and how much it helped. But quality, of course, is subjective. I remember feeling annoyed as I ran past one band playing Keep On Running. Someone else, though, may have found it uplifting.

Karageorghis had a word of warning, however, about using an iPod. "It can lead to temporary hearing loss," he says. "If you're running for over an hour with loud music in headphones, there is a health and safety issue." It is better, he says, to save the music for the end, when you really need a boost. "Like any drug, if you use it too much, it begins to have less effect."

Of course, the music was not only there to help runners to break their personal bests (although sadly it was unable to help me beat mine), but to provide a sense of occasion, draw out the crowds and create a carnival atmosphere. Along with some spring sunshine, it certainly achieved that.

As I left, all across the grass in Holyrood Park people were sitting down, still buzzing on endorphins and slightly dazed, listening to the floaty sounds of the Scottish band Kassidy. It was a fitting way to end the day.

• Running with the Kenyans by Adharanand Finn is published by Faber & Faber, price £14.99. To order a copy for £11.99 with free UK p&p, visit guardianbookshop.co.uk