Mike Birbiglia’s story about his worst sleepwalking mishap — he once crashed through a second-floor window at a La Quinta Inn in Walla Walla, Wash. — is a good one. So good that he basically built his burgeoning comedy fame on the foundation of that one crazy tale.
First “Sleepwalk With Me” was a theater piece. Then it was featured on “This American Life.” Then he wrote a best-selling book with that title. All good.
Then he made it into a movie that he co-directed (with Seth Barrish) and stars in. He cajoled Ira Glass, the creator of “This American Life,” into producing and co-writing. They assembled a very good cast including Lauren Ambrose (“Six Feet Under”) and veterans Carol Kane and James Rebhorn, and an exceptional team behind the scenes.
But despite all those good intentions, when they first watched the rough cut, it was . . . not good.
“And we had to learn how to fix it,” recalled the notably loquacious Glass, who was in Somerville in April to introduce “Sleepwalk With Me” on opening night of this year’s Independent Film Festival Boston. (The movie opens Friday at Kendall Square.) “At some point, pride kicks in. We said, ‘There’s only one way out of this, and that’s excellence, so let’s just go for that.’”
After rewriting, reshooting, and reediting, the movie won an audience award at Sundance, and it earned Birbiglia another award at this summer’s Nantucket Film Festival. He is now writing a screenplay for his second one-man show, “My Girlfriend’s Boyfriend.”
“Sleepwalk With Me” follows the lightly fictionalized story of comedian Matt Pandamiglio — Glass compared the character to Woody Allen’s alter ego Alvy Singer in “Annie Hall” — whose sleepwalking problem gets worse as his relationship with his girlfriend begins to crumble.
“There were a lot of small miracles that added up,” said Birbiglia recently, on the phone from New York, where he lives with his wife.
In the beginning, Glass had to convince Birbiglia that he would not be squandering his best material by adapting it for “This American Life,” the popular syndicated public radio program.
“I had a total business talk with him,” Glass remembered. “I said, I have to tell you, it’s only going to let people know you exist. David Sedaris — pretty much his entire book “Naked” was on the show in one form or another, and the sales were great. Sarah Vowell, same thing. David Rakoff, same thing. You’re going to be fine.”
For a comedian bred in Boston, Birbiglia, a Shrewsbury native, comes across as exceedingly mild-mannered with no hahsh accent, no Sawx hats. “For a sensitive guy, he’s a guy’s guy,” said Glass, “but that doesn’t go very far.”
Yet he has an admirable willfulness about him when it comes to the work. A film and theater student at Georgetown University, Birbiglia once read an interview with Francis Ford Coppola, Glass explained, “that said the way you make a movie is you just act like, ‘Hey, we’re making a movie. I’m heading this way, and you’re coming with me.’ It was impressive; he almost willed it into existence.”
Birbiglia was in high school when he saw his first comedy show: the bone-dry absurdist Steven Wright at the Cape Cod Melody Tent.
“That was really like a lightning bolt in my brain, saying, ‘You have to do this,’ ” he recalled. “He was cripplingly good.”
But, though he started in clubs, Birbiglia seems well-suited for the transition to film. Unlike so many of his stand-up colleagues, he’s no lone wolf.
“He’s a big committee person,” said Glass. The comedian’s brother, Joe, helps pen jokes (he shares in the writing credits for “Sleepwalk”) and runs their production company out of Providence. (Their parents now live on Cape Cod.)
Birbiglia “goes from person to person and makes jokes with them,” Glass said. “And people go, ‘Oh, I like this guy. We’re on a team.’ ”
“This American Life” got into the business of film after the success of Steven Soderbergh’s “The Informant!” (2009), which was inspired by a story that aired on the show. Though the author of the book got paid, Hollywood types descended on Glass and his team, insisting they should have claimed it as their own intellectual property, too.
“It was a misperceived wrong,” he said. “We basically did a cover version of an incredibly excellent book.” Still, it made sense to begin adapting some “TAL” stories for the screen. The show currently has “a half-dozen things” in development.
“They’re designed as little movies for radio. The narrative structure is very, very similar,” Glass said. “They’re character-based, emotional stories with surprises. They’re movies, many of them.”
But none to date have required half the effort Glass put in as a co-producer of “Sleepwalk.” He was on the set and in the editing room throughout the process. He even has a cameo appearance, as a wedding photographer.
That came about due to his fascination with the expertise of the film’s director of photography, Adam Beckman, an Emmy winner for his work on “the radio show’s short-lived TV series for Showtime.
“He’s one of the most skilled people I’ve ever met, in any job,” said Glass. “He thinks about light in a way I guess cinematographers do, but it’s really weird, like, what kind of magic trick is this?”
Likewise, Glass marveled at the ability of the accomplished actor Rebhorn (“Meet the Parents”) to resume his precise position each time the crew began a new take.
“I didn’t even know that was a skill that existed,” he said.
That kind of enthusiasm for minutiae makes Glass an ideal accomplice, said the star of the movie.
“He’s a journalist with a comedic bent,’’ said Birbiglia, “and I’m a comedian with kind of a journalistic bent, I think. . . . The speed that his brain works is so fast. Sometimes it was too fast. The rest of us needed to catch up.”
But Birbiglia is setting quite a pace of his own. Glass joked that his friend has yet to develop “any kind of hologram or a Disney ride, I’ll give him that.”
“It seemed to me early on that someday he was going to be more famous than all of us,” said Glass, who knows a thing or two about talking for a living. “I don’t know if that’s something I should say out loud.”James Sullivan can be reached at email@example.com.