Never has a humbling demotion yielded such a happy circumstance.

In April 2015, Barry Zito — signed by the A’s after a year out of baseball — was sent to Oakland’s Triple-A team in Nashville.

If the A’s had paid more attention to marketing and kept him on the team, or if the Triple-A affiliation still had been Sacramento, Zito’s path might have turned out differently.

Instead, the disappointment for the 2002 AL Cy Young Award winner opened a door of opportunity.

“It was divine intervention, or whatever you want to call it,” Zito said Wednesday night.

Zito, 38, is now a full-time resident of Nashville, where he has launched a second career as a songwriter. This week he was back in the Bay Area, performing a sold-out show in front of about 250 people at Mill Valley’s Sweetwater Music Hall, where his hard work over the past 18 months was on display.

Sitting on a stool, playing acoustic guitar, his voice was strong, with a bit of a country lilt. His lyrics were evocative and raw, opening a window on the personal struggles he had in his career as well as his romance with his wife, Amber.

“They’re definitely personal songs,” Zito said. “I’m realizing I have a lot to say.”

As an athlete, Zito was a compelling figure, experiencing the ultimate highs and lows. A member of the Big Three pitching staff with the A’s, he won pitching’s highest honor 15 years ago. After signing his record-breaking contract with the Giants following the 2006 season, he was mocked when his results didn’t match the dollars. He was left off the 2010 playoff roster. Two years later, he made significant contributions to San Francisco’s second World Series run.

Throughout it all, he was accountable and professional and approached his job with focus and preparation.

He has brought the same work ethic to his new career. The son of two musicians — his father composed and arranged music for Nat King Cole and his mother was a singer — Zito always thought music would be in his life. He started playing the guitar after he was drafted by the A’s, finding the instrument welcome company on the road.

“It was a cathartic thing for me,” he said. “If I didn’t feel in control of my pitching, I could go home and control what I was doing on the guitar. It gave me peace on the road. Video games don’t give you peace. Music works a different part of your brain. It balances you.”

Zito played with teammates and coaches, including former Giants third-base coach Tim Flannery. Zito wrote snippets of songs. He even recorded an album in 2011 but did not release it, knowing it would be poor timing as he struggled on the mound.

While he was pitching for the Nashville Sounds, the Tennessean newspaper did a story on Zito in which he mentioned his songwriting aspirations. Robert Filhart, now his agent, worked in the industry and contacted him. He connected Zito with writing workshops.

“In the first meeting, yeah, maybe someone took a chance on you because they were a baseball fan,” Zito said. “But to get a second meeting, that’s where you’ve got to earn it.”

Zito acknowledges he is fortunate. He is in writing rooms with songwriters whose ability to support their families depends on whether they can create a successful hit.

“I see the stress in their eyes,” he said. “I’m not in that position. But, unlike pitching, this is something I can keep doing for the rest of my life.”

He and Amber and their 2-year old son Mars, have decided that Nashville is home. Zito is selling his house in San Diego. Amber’s family is a four-hour drive away in Missouri. The family home is in a neighborhood, walking distance to shops, a far cry from the spectacular retreat on Mount Tamalpais that Zito purchased after he signed his big contract with the Giants.

“I don’t know why I bought that house,” Zito said. “I was like a hermit on the hill.”

He rarely has been back in the Bay Area. As part of his visit, he did a Facebook Live concert at the Gotham Club at AT&T Park, the first time he had set foot in the ballpark since his emotional farewell Sept. 29, 2013.

“It felt so weird,” he said.

That was then and it provided plenty of material for Zito to tap. This is now: His album was released Friday on his website BarryZitoMusic.com.

On Wednesday, Zito walked on stage to loud applause and whoops from an audience of both A’s and Giants fans. After some introductory comments, he started to sing.

“It ain’t about the money that you’ve got in the bank,

It ain’t about how many hearts that you can break,

It doesn’t matter how many people know your name or what they say…”

Ann Killion is a San Francisco Chronicle columnist. Email: akillion@sfchronicle.com Twitter: @annkillion