If London had the grid system of Manhattan, or had been rebuilt entirely like the Paris of Haussmann, then maybe it would have a readily identifiable sound. After all, you can spot the sound of Manchester – whether it's the Hollies, Joy Division, the Stone Roses or MC Tunes – at 20 paces. London has always been more fluid, in its architecture and its population. Different eras, and different postcodes, define the sound of the city at any given time. The Barbican's forthcoming Songs In the Key of London event could have included such mismatched performers as Chas & Dave, Rod Stewart, and Dizzee Rascal on the bill and it would have all made perfect sense.

Instead, along with likely lads Suggs and Chris Difford, it features a bunch of singers who aren't even from London – Robyn Hitchcock is Cambridge to his toes, Kathryn Williams's Byker Grove accent is a bit of a giveaway. The reason they will be sharing a stage with compere Phil Daniels is that most of the great London songs have been written by outsiders and suburbanites.

David Bowie, tucked away on the fringes of Kent in Beckenham, wrote a few pre-fame songs in the 60s about moving to the big bad city: Can't Help Thinking About Me saw him on the station platform, I Dig Everything was a sarcastically joyous arrival ("I've got more friends than I've had hot dinners/Some of them are losers, but the rest of them are winners"), and, best of all, the London Boys saw the former Face on his knees, beaten down by the cold, pill-popping demands of the city; even in 1966 Bowie was ahead of the game, giving Swinging London a scornful kick. Ray Davies penned the similarly damning Big Black Smoke in the same year, though where Bowie had used a sobbing voice and Tony Hatch's foggy brass section to highlight the city's meanness, the Kinks sneered and stomped all over the smashed dreams of the arriviste country girl: "Every penny she had was spent on purple hearts and cigarettes."

With even more scorn, Sleeper's Gants Hill-born singer Louise Wener wrote a revenge song for the whole city, winningly entitled Cunt London. The fact Morrissey hates the whole city has never stopped him writing about it: Dagenham Dave may be a clunky Essex boy caricature but Come Back to Camden is entirely evocative of mouse-ridden bedsits. He sings of "drinking tea with the taste of the Thames", the only recorded complaint about the city's hard water.

The further the writer lives from London the more he is likely to romanticise it. Bob Merrill wrote such brainless singalongs as How Much Is That Doggie in the Window and Mambo Italiano, but on She Wears Red Feathers – a 1953 No 1 for Guy Mitchell – the singer works in a London bank where "from 9 to 3 they serve you tea" before meeting a native girl (in a "huly huly skirt") who sails back to London for a life of tea-drinking antics in Piccadilly. It's ludicrous but adorable. Another American, Nat D Ayer, wrote Dear Old Shepherds Bush when he first arrived in London – has anyone else in the world ever thought of that grizzled triangle of grass with such unabashed love?

If Ayer had spent more than a day or two in his dear old Bush he might have written quite a different song. Some parts of London are impervious to gentrification or hipness and remain defiantly unloveable. For the teenage Marc Bolan, a move from happening Hackney to tedious Tooting, where he he was no longer a mod face, was written up in the wry Over the Flats – part glam demo, part music-hall moan. Finnish band Hanoi Rocks moved to deeply unfashionable SW17 and commemorated their grim times there in Tooting Bec Wreck: "I'm the sort of case that people find hard to face/I'm the living wreck, I live in Tooting Bec/I'm the Cosmic Ted spaced out of my head." Not a great song, but still the greatest song ever written about Tooting. You can travel a short distance and the musical climate will change completely. A few tube stops from from Tooting, Brixton has two solid London classics to its name in Eddy Grant's Electric Avenue and the Clash's paranoid but prescient Guns of Brixton, released 18 months before the 1981 riots. A mile or so east, Camberwell is only celebrated in a comical way – Basement Jaxx have paid winking respect to it three times over with I Live in Camberwell, Camberwell Skies and Camberskank while Gracie Fields's Heaven Will Protect an Honest Girl has her losing both dignity and clothing in SE5: "I pawned me shawl in Camberwell/Then me skirt and blouse I sold 'em, and went trampin' back to Oldham." It's pretty obvious that a cool area like Brixton will inspire songs with a little more gravitas, yet that doesn't entirely explain why Brixton songs have an air of impending menace while songs about Portobello Road are almost uniformly skippy and tend to feature a whistling solo: The Spectrum (more famous for singing the Captain Scarlet theme), Cat Stevens and Caetano Veloso all eulogise London's most Trumptonesque street. I put it down to the architecture; brightly painted Georgian terraces are more likely to inspire a whistle than towering Victorian edifices. In the 60s, Portobello Road was an oasis of gaiety. Just a few yards west, Notting Hill was a grim area namedropped by Van Morrison on Friday's Child, He Ain't Give You None ("I got messed up 'round somewhere called Notting Hill Gate/I lived up there for a while and when I moved out I was in such a state") and the distressing TB Sheets, a British blues about a lonesome death in Ladbroke Grove's Rachman slums. Architecture changes, though; Ladbroke Grove is now as chi-chi as Chelsea was in 1967. But not everywhere is upwardly mobile. It is fascinating to take a square mile of London and see how it has been recorded in song over the decades. The East End music halls filled and eulogised by Marie Lloyd with songs like The Boy I Love Is Up in the Gallery at the turn of the 20th century were largely wiped out by the Luftwaffe; Duncan Browne sang about post-war childhood games On the Bombsite, referencing the remnants of Garden Street in Stepney; on Play With Fire, the Rolling Stones mocked the slumming socialite who "gets her kicks in Stepney, not in Knightsbridge any more"; and in 1993 Pulp – then poverty-stricken students just down from Sheffield – lived in a tower block that was built on Duncan Browne's rubble, and wrote Mile End to commemorate their less than charming home: "It was on the fifteenth floor, it had a board across the door/It took an hour to pry it off and get inside, it smelt as if someone had died." Some districts have a sound that seems to seep, unalterable, from the pavements. A few miles north west of Mile End is a leafy corner of London which drew in pastoral folkies from St Albans, Kingston, Tanworth-in-Arden and Glasgow – Muswell Hill is where you'll find a gorgeous arts and crafts pile called Fairport, and this is where a budding psychedelic band called Fairport Convention shacked up in 1967. Having settled in the Edwardian suburb, surrounded by woods and parks with jaw-dropping views over the city, their sound quickly mutated into folk rock. Living within cycling distance were the similarly wistful Sandy Denny (soon to become their singer), Nick Drake, and John and Beverly Martyn. Clearly the vistas of Highgate Wood and Alexandra Park affected the music of the locale as deeply as Ridley Road market and the semi-dereliction of Clapton and Dalston have dictated jungle/UK garage/grime narrative of the last 20 years. Manchester denizen Anthony Wilson reckoned that London had no musical soul. The truth is that it is impossible to pin down, it shifts constantly, which is why the city continues to be a draw for talents who – whether they love the place or not – end up creating its soundtrack. Take a look on YouTube at a clip of Nico singing I'm Not Sayin'. Wandering around an unrecognisable Docklands in 1965, here's a German model singing a song written by Canadian folkie Gordon Lightfoot, produced by Hampstead public school boy Andrew Loog Oldham, yet it has the authentic feel – with its chutzpah, its minor chords, its refusenik lyric and foggy air – of something essentially, perfectly London.

Five songs about less celebrated parts of London: New Vaudeville Band – Finchley Central

With its 20s bent and megaphone vocal, this makes for a sunnier ode to London Transport than Down in the Tube Station at Midnight: the singer is nonetheless stood up on the platform having travelled "10 long stations from Golders Green" for a fee of "two and sixpence". Nick Nicely – Hilly Fields 1892

A veteran of just two singles, Nicely still managed to record the best psychedelic songs of the 80s with a mellotron-soaked evocation of a paranormal event at a south London beauty spot. The only building on Hilly Fields is now a music school. Elvis Costello – Hoover Factory

"Five miles out of London on the Western Avenue/Must have been a wonder when it was brand new." For once, a Costello song is simple, pun-free and heartfelt. The now listed (and currently empty) deco marvel was in danger of demolition at the time that this was recorded; it's survival was "not a matter a life and death – but what is?" Mott the Hoople – Waterlow

Following a divorce, Ian Hunter wrote this gorgeous cello-led song about walking around the titular Highgate park with his young son in a pushchair. Mott later gave the London borough of Croydon a much needed high five on Saturday Gigs. Nadia Cattouse – Bermondsey

"The tide is turning now on barges in Bermondsey." The area has changed more than Belize-born Cattouse could have imagined when she sang this in 1969, just as the docks were starting to close. Cold but wise, it has a beautiful 2am feel: "On London Bridge young lovers shiver and gaze at the lamplight in the river."