In this excerpt from “Shy: The Alarmingly Outspoken Memoirs of Mary Rodgers,” a Broadway musical is born at a summer camp.A hundred-mile drive from New York City, on the fringe of the Pocono Mountains, Tamiment was for much of the last midcentury a resort for singles and a summer intensive for emerging theatrical talent. During the first half of each season, writers assembled an original musical revue every week; in the second half, if they were interested in cranking out a show with a story — and if Moe Hack, the barky, crusty, cigar-smoking sweetheart who ran the place, thought it was a good idea — they would be free to try.Among those who tried in the summer of 1958 was Mary Rodgers, a young composer whose father’s reputation preceded her; he was, after all, Richard Rodgers. Also at Tamiment was the lyricist and book writer Marshall Barer, her mentor and tormentor. Together, with assists from Dean Fuller and Jay Thompson, they would write the musical “Once Upon a Mattress,” a perennial favorite that grew from a summertime opportunity into an Off Broadway and Broadway success starring Carol Burnett. “Mattress” was also an unintentional self-portrait of a displaced young princess trying to find happiness on her own terms.“Shy: The Alarmingly Outspoken Memoirs of Mary Rodgers,” written by Rodgers (1931-2014) and Jesse Green, the chief theater critic of The New York Times, is the just-published story of that princess. Over the course of two marriages, three careers and six children, sometimes stymied by self-doubt, the pervasive sexism of the period and her overbearingly critical parents (not just Richard but the icy perfectionist Dorothy), she somehow triumphed. But in this excerpt about the birth of her first (and only) musical hit — there would be substantial successes in other fields too — she recalls how triumphs can sometimes depend on little more than scrappiness, high spirits and a castoff from Stephen Sondheim.In New York City, Carol Burnett won the role of the Princess, whose sleep is disrupted by the incessant shrilling of the Nightingale of Samarkand, in “Once Upon a Mattress.”Friedman-Abeles/The New York Public Library for the Performing ArtsMARSHALL FOUND ME a nice four-bedroom cottage for very little money, right down the hill from Tamiment’s main buildings and near a rushing river. He even saw to it that an upright piano was waiting in the living room. And Steve, now flush from “West Side Story,” sold me his old car for a dollar. Off we went like the Joads in early June: 27-year-old me; the kids, ages 5, 4, and 2; and the Peruvian nanny — all of us scratching westward thanks to Steve’s itchy fake-fur upholstery.My von Trapp-like cheerfulness in the face of uncertainty soon crashed, though. The whole first half of the season was, for me, demoralizing. Everybody was more experienced than I. Everybody was, I felt sure, more talented. Everybody was certainly more at ease. At the Wednesday afternoon meetings to plan material for the coming week, when Moe would fire questions at us — “Who’s got an opening number?” — the guys would leap up to be recognized like know-it-alls in math class. If they were little red hens, I was the chicken, silently clucking Not I. “Who’s got a comedy song?” More leaping; more ideas. “Who’s got a sketch?” Woody Allen always did.At 22, Woody looked about 12 but was already the inventive weirdo he would become famous as a decade later. His wife, Harlene, who made extra money typing scripts for the office, was even nerdier, but only inadvertently funny. She looked, and sounded, a bit like Olive Oyl, with reddish hair, freckles, and a bad case of adenoids. Woody, whenever he wasn’t working on his sketches — his best that summer was about a man-eating cake — was either sitting on a wooden chair on the porch outside the barracks, practicing his clarinet, or inside with her, practicing sex, possibly from a manual. He was doing better, it seemed, with the clarinet.I would spend eight hours a day plinking out tunes to accompany Marshall’s lyrics. These were revue songs, with titles like “Waiting to Waltz With You,” “Miss Nobody,” and “Hire a Guy You Can Blame,” fitted to the talents of particular performers with no aim of serving a larger story. “Miss Nobody,” for instance, with its super-high tessitura, was written for a thin little girl named Elizabeth Lands, who couldn’t walk across the stage without falling on her face but was a knockout and had an incredible four-octave range like Yma Sumac.Burnett, left, and Rodgers moving a mattress into the Alvin Theater (now the Neil Simon Theater) on Broadway in November 1959. The show had premiered earlier that year at an Off Broadway theater, the Phoenix, in the East Village.Bettmann/Getty ImagesMusic did not pour out of my fingers; the process was more like wringing a slightly damp washcloth. With Marshall’s lyric propped up on the piano desk, precisely divided into bar lines as a road map, I would begin with some sort of accompaniment or vamp or series of consecutive chords, then sing a melody that matched the lyric and went with the accompaniment, then adjust the accompaniment to service the melody, which began to dictate the harmony, until I had a decent front strain that satisfied me and, more important, satisfied Marshall, who wouldn’t stop hanging over my shoulder until he liked what he’d heard. Then he’d leave me to clean it up and inch it forward while he took a long walk on the golf course to puzzle out the lyrics for the bridge. Back to me, back to the golf course, back and forth we went, until the song was finished.Even when I did that successfully, I had another problem. My abandoned Wellesley education had taught me the rudiments of formal manuscript making, but Daddy had ear-trained me, not eye-trained me. As a result, I kept naming my notes wrong, calling for fourths when I meant fifths, and vice versa. This made the orchestrations sound upside down. I could just imagine the guys saying, “Get a load of Dick Rodgers’s daughter, who can’t even make a lead sheet.”Actually, the orchestra men, kept like circus animals in a tent apart from the rest of us, were the merriest people at Tamiment. They weren’t competitive the way the writers were. They just sat there with a great big tub filled with ice and beer; you tossed your 25 cents in and had a good time. And I had the best time with them. Especially the trumpeter.Mary, left, with her parents, Dorothy and Richard; her sister, Linda, center; and Zoë d’Erlanger, right, who lived with the family for a time during World War II.via the Rodgers-Beaty-Guettel familyElsewhere at Tamiment, I felt patronized. It didn’t help that Marshall tried to dispel my parental paranoia by preemptively introducing me to one and all as “Mary Rodgers — you know, Dorothy’s daughter?” Between that and the chord symbols, it was enough to drive me to drink.Or pills, anyway.“What’s that you’re taking?” Marshall asked, when he saw me swallowing one.“Valium,” I told him.“Valium!” he screamed. “Why Valium?”“I asked the doctor for something to help me write.”“And he gave you Valium?” said Marshall. “Here. Try this.”He handed me a pretty little green-and-white-speckled spansule.Bingo! I wrote two songs in one day, and, whether because of the Dexamyl or the songs, felt happier than I’d ever been. It completely freed me up. Whatever inhibitions I had about playing in front of Marshall or feeling creative and being able to express it were suddenly gone.The story of me and pills — and, much more dramatically, Marshall and pills — can wait for later; what matters now is that Marshall had for a couple of years been nursing the notion of turning the Hans Christian Andersen fairy tale “The Princess and the Pea” into a musical burlesque for his friend Nancy Walker. Nancy, a terrific comedian, liked the idea but was too big a star by then to be summer-slumming at Tamiment. Still, since Marshall was stuck with me anyway, he figured it was worth a try. Did I like the idea? he asked.As it happens, I did, very much, but it wouldn’t have mattered if I hated it. I did what I was told. At Tamiment, even Marshall did what he was told. Moe said we could write this “pea musical” on the condition that it would accommodate his nine principal players with big roles. Nine big roles? Moe had hired them at a premium, he said, and he wanted his money’s worth.The deal struck, Moe scheduled the show for Aug. 16 and 17. It was now late July.The program for the Tamiment Playhouse performance of “The Princess and the Pea,” as the musical was known that summer of 1958.Jesse Green/The New York TimesTo save time, we custom-cast the show on the cart-before-the-horse Moe Hack plan, before a word, or at least a note, was written. There was, for instance, a wonderful girl, Yvonne Othon, who was perfect for the lead, Princess Winifred: appealingly funny-looking, very funny-acting, and the right age — 20. But there was a significant drawback: She wasn’t one of Moe’s principal players. Meanwhile, Moe wanted to know what we were going to do for Evelyn Russell, who at 31 was deemed too ancient to be the Princess but was a principal player. OK, OK, we’d cast Evelyn as the Queen: an unpleasant, overbearing lady we just made up, who is overly fond of her son the Prince and never stops talking. We would give her many, many, many lines and maybe even her own song. And to seal the deal, even though the Princess was (along with the Pea) the title character, we would cut her one big number; we’d been planning to have her sing “Shy,” a revue song that hadn’t worked earlier in the summer. That was just as well because it was a tough, belty tune and Yvonne couldn’t sing a note. She was a dancer.Lenny Maxwell, a comedian and a schlub, would be Prince Dauntless, the sad sack who wants to get married but his mother won’t let him; since he had limited singing chops, we’d only write him the kind of dopey songs any doofus could sing. We created the part of the Wizard for a guy who, I had reason to know offstage, was spooky; he was practically doing wizard things to me in bed. Meanwhile, Milt Kamen, by virtue of his age (37) and credits (he’d worked with Sid Caesar), was considered by Moe, and by Milt, to be the most important of the principal players, but he too had a couple of drawbacks: He couldn’t sing on key and couldn’t memorize lines. He claimed, though, to be an excellent mime, so Marshall and Jay invented the mute King to function as counterpoint to the incessantly chatty Queen. Marshall brilliantly figured out a way to make his lyrics rhyme even though they were silent: They rhymed by implication.In this way, one role at a time, we wrote the show backward from our laundry list of constraints: a dance specialty for the good male dancer who played the Jester, a real ballad for the best singer, even a pantomime role for Marshall’s lover, Ian, who moved beautifully but, well, fill in the blank.Soon all personnel problems were solved except what to do with Elizabeth Lands. You remember, the gorgeous but klutzy Yma Sumac type? When Joe Layton, the choreographer, and Jack Sydow, the director, started teaching all the ladies of the court — who were meant to be pregnant, according to Marshall’s story — how to walk with their hands clasped under their boobs, tummies out, leaning almost diagonally backward, Liz kept tipping over. Pigeon-toed? Knock-kneed? We never discovered what exactly, but she was a moving violation. Thus was born the Nightingale of Samarkand, who was lowered in a cage during the bed scene while shrilling an insane modal tune to keep the Princess awake.Do not seek to know how the musical theater sausage is made. More