Writing Broadway musicals, as visitors from the pop, rock, folk and country music worlds are finding, can be a time-consuming and only occasionally lucrative endeavor. And pivoting from the familiar world of composing pop songs to the collaborative craziness of the Broadway musical can induce a sort of cultural whiplash. Sara Bareilles spoke to the New York Times about her experience writing Waitress.

“It actually took me a long time to say that I love this project. It was very hard; it was confusing; it was foreign. I think I was having a little bit of an out-of-body experience with it for maybe the first year of working on this show.”

Yet in a career that has brought her a #1 album, five Grammy nominations and a celebrity judgeship on the NBC a cappella competition “The Sing-Off,” the 36-year-old said she’s never felt such a sense of reward.

“Some of that is related to the sheer man-hours that it’s required of me. I’ve never worked on anything this hard, and this long, and this sincerely.”

The road to Broadway for Waitress, which opens 24 April at the Brooks Atkinson Theater, has taken nine years and cost $12 million. The veteran producers Barry and Fran Weissler picked up the theatrical rights to the Adrienne Shelly movie just after its release in 2007, spying musical potential in the imperfections and desires of the characters.

They also saw a project – a mix of feminist fable and romantic fairy tale – that could resonate with women, who drive Broadway sales. Two creative teams didn’t pan out. Soon after hiring the director Diane Paulus, with whom the Weisslers worked on the Tony award-winning revival of Pippin, they opted for a different approach.

Diane said: “It wasn’t this big, bold Broadway musical. This was something more delicate, maybe something that required a new kind of musical theatre voice.”

She put together a wish list of songwriters who had never written for the musical theatre. The first slot belonged to Sara Bareilles; Diane never talked to anyone else.

Between touring and shooting “The Sing-Off,” Sara felt exhausted and overwhelmed, uninspired and too comfortable. “I wasn’t unhappy, but I just felt unalive,” she said. She broke up with a longtime boyfriend, and her longtime band; and she would soon move to New York after 13 years in Los Angeles. Musical theatre, she told her agents, was something she’d like to explore.

Sara was first exposed to the form growing up in Eureka, California, where her mother and older sisters were involved in community theater. Nunsense was among her earliest musical memories – she took up tap dancing because of the show – and she repeatedly listened to cast albums like Oklahoma! and Miss Saigon. (“I think she knows some musicals better than me,” Diane said. “She can sing the whole opening of Beauty and the Beast.”)

When the first call came, Sara hadn’t seen the Waitress movie, but its quirkiness – and the untraditional love story at its heart – appealed to her. “It’s actually about a woman’s seeking to feel like she’s worthwhile in the world,. So her being seen, truly seen by her love interest, is more about her feeling she matters to the world than just hearing, ‘I love you and want to run away with you.’”

“As a writer, I tend to be very protective of my work until it’s completely finished, fleshed out, until I’m ready and willing to go to battle for it. That is less helpful in this process, because this show depends on the music serving the book, the book serving the music, the music serving the actors. Everything has its mirror image.”

While she can still feel herself bristle at feedback, she has become less precious about her ideas, especially as she’s become more comfortable with her creative team colleagues, who include the book writer Jessie Nelson. She now understands that they’ll be revisiting everything dozens of times before the show opens.

During a Saturday rehearsal, less than three weeks before the start of previews, one of those changes was being worked out. Since its run last year at the American Repertory Theater in Cambridge, Mass., “Waitress” has been altered considerably. Scenes rewritten, moved and jettisoned, parts recast, rethought and deepened. The biggest difference: a new movement vocabulary from the incoming choreographer Lorin Latarro, which attempts to unlock the fantasy life of Jenna during her pie-making études and to turn a static show into one where the ingredients (the ensemble and band, in particular) literally swirl on stage.

Although the music has changed the least among the creative elements – there’s just one new song – that doesn’t mean Sara’s workload has lightened. Songs have shifted, lyrics have been reworked. And even the smallest staging adjustment can mean a tweak to the music.

After a run-through of “Never Ever Getting Rid of Me,” a first act song given to Ogie, the oddball suitor of one of Jenna’s fellow waitresses, Diane called Sara over. The pie-making reverie Jenna then falls into was no longer as romantic, but a little more salty and quirky. The music, namely the underscore, now needed to match the action.

Sara huddled with the piano player and drummer. She suggested a change in the orchestration to give the song a bit more oomph, humming along as they tested it out. A few moments later, after the actors had gone through the scene again, she was asked if the change had done the trick. “We shall see,” she said, knowing full well more alterations were bound to come.

Sara would love to do it again. Already, she is contributing a song to The SpongeBob Musical, due next season.

“I think I felt more freedom writing for the stage. It’s kind of a free-for-all. The sky’s the limit, in a really great way.”