When Mark Mallman’s editor first heard his book pitch about songs that helped him survive a bout of depression and anxiety, he assumed that the Twin Cities rock musician meant the usual miserable stuff.

“I figured it’d be a ‘High Fidelity’ kind of book and he was listening to people like Nick Drake and Kurt Cobain,” recalled Adam Wahlberg of Think Piece Publishing. “When I mentioned those specific artists, though, he actually got kind of mad.”

A piano-pounding indie-rock vet who made his name by pulling off bold stunts — such as a legendary 76-hour marathon concert — Mallman attempted maybe his most surprising endurance test yet during the winter of 2014-15.

He made a pledge to listen to nothing but happy music. Using Spotify, the 45-year-old singer/songwriter put 50 sunshiny tunes on an endless loop all winter long.

What happened next — in his newfound listening habits and his attempt to revive his personal life — are recounted in often touching and sometimes wryly hilarious details in a new memoir, “The Happiness Playlist.”

It wasn’t so much an experiment as “a desperate act of self-defense,” Mallman said. At the time, he was stinging from a breakup with a longtime girlfriend and still mourning the sudden death of his mother in 2013.

Lila Mallman and her son learned how to play piano together, and she also taught him the joys of trying to make other people happy. But her son could not find the tools to make himself happy.

His depression gave way to sudden bursts of anxiety that woke him up in the middle of the night, setting the playlist idea in motion.

“It became a physical thing,” he said. “Certain things would literally trigger a negative physical reaction” — including the fiery Nine Inch Nails song “Heresy” and the freaky Ralph Steadman paintings at Hell’s Kitchen in downtown Minneapolis (art he otherwise adored).

So it was out with the NIN, Nirvana, Joy Division, Smiths, Patti Smith and all the other mopey/angsty music that heavily defined Mallman’s Generation X, and in with the Pharrell, Bob Marley, Staple Singers, Whitney Houston, ELO, Gorillaz and all the other unabashedly upbeat and hopeful tunes he could find (and stomach) for four months straight.

“A lot of my friends would say they hate a song like Pharrell’s ‘Happy,’ ” Mallman said, “but I clung to it. I needed that different kind of physical response you get from a song like that, a song obviously meant to make you get up and dance.”

‘Happy’ ending?

“Happy” wound up at No. 19 on Mallman’s happiness list, between Van Morrison’s “And It Stoned Me” at No. 1, Randy Newman’s “You Got a Friend in Me” in the 50th slot and all those aforementioned artists with good vibes. (See Mallman's five top can't-fail feel-good songs here.)

In the breezy but hardly light 130-page book that grew out of the play­list, random day-to-day occurrences became meaningfully intertwined with the drama (or lack thereof) in the music — things such as having the back window of his van shot out by a pellet gun, or going to the Milwaukee Public Museum with his amazingly supportive dad when he went home to Waukesha, Wis., for his first Christmas without his mom.

Mallman will promote the book in his adopted hometown with — what else? — a gig with friends at 7th Street Entry in Minneapolis on Friday.

Even during the long, dark months chronicled in the memoir, he remained active as a musician. He worked on film and commercial music and crafted one of the best albums of his nearly quarter-century career, 2015’s emphatically titled “The End Is Not the End.”

It’s the same show-must-go-on resiliency that he drew upon to perform “Let It Be” at his mom’s memorial service without breaking down.

“I had a harder time hearing Paul McCartney sing that song in concert than I did singing it at her funeral,” he said. “Playing music is a very proactive thing. Listening to it is a lot more passive.”

In the book, Mallman explains how and why he could no longer find catharsis hearing the more down-and-out songs that he and many other die-hard musicheads consider the mightier and more meaningful music in pop culture. So he just went for the full-bore poppy stuff.

“Feel-good music doesn’t fail me,” he writes. “Major chords and positive lyrics give faith to know that everything works out all right. … Happy music unsticks the muck from the boot heels.”

Much of the memoir grew out of diary entries during his winterlong sugar binge.

His editor thinks “you can tell Mark is very into movies and sees the world through artists’ eyes by the concise, creative way he writes.” Wahlberg also praised a more pragmatic side to the memoir: “He did want this to be a useful book to help people, and I think it is. One of our big goals at Think Piece is to just get people talking more openly about [mental illness], and his book is an unusually fun way to achieve that.”

Mallman doesn’t want to oversell how effective his playlist idea was. Going cold turkey on alcohol consumption also helped him get healthy again, even though he believes he never suffered from alcoholism. He also enlisted therapy, antidepressant drugs, meditation, a sleep study “and a whole gamut of more common remedies” for stress, topics not really covered in the book. (“There are already plenty of good self-help books about those things,” he said.)

“This playlist is just one small, relatively simple solution I came up with myself. Putting a song on: It doesn’t come much easier than that. But sometimes 10 small things like this can be as effective as one big, complex solution.”

He also doesn’t want to overstate his love for the 50 songs: “Eventually, I did get pretty sick of a lot of it,” he said.

The idea worked, though.

“Obviously, it wasn’t a total cure-all,” Mallman said, then mustered that mischievous, piano-climber smile so recognizable from his live gigs. “But I’d be pretty shameless if I titled the book ‘The Happiness Playlist,’ and it didn’t actually have a happy ending.”