CAROLE King never wanted to watch the musical play based on her life. This is what the iconic singer/songwriter who penned a stream of 1960s hits with husband and writing partner Gerry Goffin before recording her 1971 classic album, Tapestry, told Hollywood writer and director Douglas McGrath when the pair first met to talk about the project.

McGrath's book would go on to be drawn from a series of interviews with King, Goffin and their songwriting contemporaries Barry Mann and Cynthia Weil.

King was happy to sign over the rights of such era-defining pop nuggets as Will You Love Me Tomorrow and the more reflective You've Got A Friend, but she didn't want her presence in the audience to distract from what was happening onstage. Given that some of that would be the breakdown of her marriage to Goffin, the idea of the audience looking at her while this was happening didn't appeal.

McGrath went along with this, and figured that once the show opened she'd soon change her mind. For a while, at least, King stuck to her guns. She wasn't there on opening night in San Francisco for what was now a show called Beautiful, named after one of her songs on Tapestry. Nor was she there for the first night on Broadway in 2014. Gradually, however, King's curiosity got the better of her after friends kept telling her how good it was. When she finally came to see the show, which opens next week in Edinburgh as part of a tour that also takes in dates in Aberdeen and Glasgow, it made for one of the most momentous nights of Beautiful's life.

“She came in disguise,” says McGrath. “Only a few of us knew when she was going to come. The cast didn't know at all. The night she did come, it was a benefit for Equity Fights AIDS, and at the curtain call, the actors were lined up, and were asking the audience to donate. I saw Carole slip out of her seat to go up there. All of a sudden, out comes Carole King, and one by one, you could see the cast gasp as they recognised her. By the time she got to the middle of the stage, the audience were on their feet.”

Someone in the audience called out for King to sing. At first she demurred, but then said she would, but only if people bid for it.

“Three people each bid $10,000,” says McGrath, “and Carole said she'd take all three. Then she sang You've Got A Friend. She tried to get Jessie Mueller, who was playing Carole, to join in with her, but Jessie stood back from that, because she knew the audience wanted to hear the real thing. Then at the end of the song, Carole passed the microphone down the line, so each member of the cast could sing the line, 'You've got a friend'.”

Watching this, McGrath says, “was like a movie. It had been five years since we'd begun working on the show, and then there had been three months of Carole not coming to see it, but there was such love and affection in the theatre, both onstage and in the auditorium. Me and my wife Jane stood at the back watching Carole and Jessie onstage together, and I knew that this was one of those things, and one of the ten stories that will stay with me forever.”

The original Broadway production of Beautiful went on to be nominated for seven Tony awards, winning two. The 2015 London production was nominated for eight Oliviers, again picking up two. This not only proved the enduring appeal of King's music, but that McGrath's hunch after being approached to write a King based jukebox musical that it should be King's story rather than a Mamma Mia! style fiction was correct.

“Like a lot of people, I knew Carole King best through Tapestry,” he says of the multi-million selling album that spawned such contemporary classics as It's Too Late, You've Got A Friend and (You Make Me Feel Like) A Natural Woman. “Then I discovered that for twelve years before Tapestry, Carole was a top song-writer. Then I found out she started out when she was sixteen, and wrote Will You Love Me Tomorrow when she was seventeen. I thought, who is that girl? She wasn't just writing dumb pop songs. They were sophisticated, beautiful and had real depth. She married Gerry Goffin when she was young, and became pregnant when she was young. There where strains on the marriage, and there was this complex and troubled love story.”

As the 1960s progressed, and as song-writers moved more into the spotlight, the Goffin/King canon marked how pop music itself was growing up in public.

“As well as being a story of four wonderful writers, it's also a history of pop music,” says McGrath. “At the beginning of the show, the writers are working in their booths at 1650 Broadway, and it's all very regulated. Writers wrote, but they didn't sing. Then the Beatles and Bob Dylan come along and showed what's possible, and it became okay for writers to sing their own songs. That's how we got Tapestry.”

McGrath's own writing career began in the early 1980s on American comedy show, Saturday Night Live. He later co-wrote Bullets Over Broadway with Woody Allen. McGrath went on to write and direct the 1996 big-screen version of Jane Austen's Emma, which starred Gwyneth Paltrow, Alan Cumming and Ewan McGregor. More recently, he directed Sarah Jessica Parker and Christina Hendricks in an adaptation of Allison Pearson's novel, I Don't Know How She Does it.

A film version of Beautiful has been mooted since 2015, when it was picked up by Tom Hanks' production company, Playtone, and may yet see the light of day. In the meantime, McGrath is working on a new musical.

“I'm at the very beginning of the process,” he says. “It's a little bit like climbing a mountain, only when you get to what you think is the top, you discover there's more and more mountain.”

Given the labour of love that Beautiful has become, what, then, is McGrath's favourite number from the show?

“For sentimental reasons I love Beautiful,” he says, “but the song that really stands out for me is Will You Love Me Tomorrow. It's so deeply poignant and wonderfully vulnerable. It's so specific as well. It could be being sung by a character in a Tennessee Williams play.

“When the Shirelles had it, they thought it sounded like a country and western song, but to persuade them to do it, Carole said to them that the song was going to have a string section on it. In those days that didn't happen very often, but Carole had no idea how to arrange for a string section, so she went to the library, and she learnt how to do it real quick. Then she went into the session, and she had this bunch of old guys from the Philharmonic sitting there looking at her, this teenager in jeans.

“That was Carole all over. She had such wonderful confidence in her ability. She said, I wrote the song, I'm running the session, let's get on with it. That says everything you need to know about Carole King.”

Beautiful – The Carole King Musical, The Playhouse, Edinburgh, November 28-December 2; His Majesty's Theatre, Aberdeen, January 23-27 2018; King's Theatre, Glasgow, February 13-17 2018.

www.beautifulmusical.co.uk