Rudy Perez may not be a household name, but he's sure worked with many who are — among them Christina Aguilera, Beyoncé and even Michelle Obama — as he details in his memoir, "The Latin Hit Maker."

Perez, 61, has written more than 300 Top-10 songs, won five Grammy awards and co-founded the Latin Grammys, the Latin Academy of Recording Arts and Sciences and the Latin Songwriters Hall of Fame. He's worked in the music industry for four decades as a recording engineer, producer, songwriter and singer.

He describes the highs and lows of his journey to becoming a legend in the Latin music world in his book, which hits shelves Tuesday.

Despite his enviable musical career, Perez says that when someone asks him what does, he has a simple reply. “I am a songwriter and musician. My passion is writing songs," he tells NBC News. "I could sit down and play my piano for nine hours nonstop and not think of anything else. It’s everything to me.”

Perez produced the Spanish-language version of the "Dreamgirls" album and other Spanish songs for Beyoncé, including her duet with Shakira, “Beautiful Liar” (“Bello Embustero”). He also produced “Move Your Body” (“Mueve Tu Cuerpo”), the theme song to former first lady Michelle Obama’s “Let’s Move” campaign.

He also produced Aguilera’s crossover Spanish-language 2000 album, “Mi Reflejo,” and wrote a duet song, “Si No Te Hubiera Conocido,” for her and a young Luis Fonsi — who later went on to worldwide fame with the release of his 2017 global hit, “Despacito.”

Christina Aguilera with Rudy Perez and record executive Ron Fair. Courtesy of Rudy Perez

In his memoir, Perez recounts how he and his family immigrated from Pinar del Río, Cuba, when he was 10. They came as refugees on one of the “Freedom Flights” — sponsored by the U.S. government — to Miami after Fidel Castro took power in Cuba. His family arrived with nothing except the clothes they had on.

“A lot of people know me, or think they know me through my songs, but they don’t really know all the struggles I went through,” Perez said. “I wanted [the book] to be an inspiration. If I did it, you can do it too, and it was also through the grace of God.”

Perez details some turbulent years in his early teens.

“As I started high school, the pressure and bullying from gangs was inescapable,” he writes in his book, adding he joined a large Cuban gang called the Vulcans. “I had no choice if I wanted to live.”

At 15, he was arrested and sent to a juvenile jail for six months, two hours away from his home.

But after his release, he turned to music. He started taking guitar lessons from a local teacher, learned piano at his family’s church and then joined a Miami-based band called Pearly Queen. At 17, he left home to tour the country with his band. That led to his break in the industry as he mastered many aspects of the trade along the way.

When he landed a job at Climax Recording Studios in Miami in his 20s, Perez asked if he could move a mattress in and sleep under the recording console. He saved money and spent many hours working with some of the biggest Latin artists of that time, including the late salsa legend Celia Cruz, the internationally renowned Spanish singer Julio Iglesias and the singer known as El Puma, José Luis Rodriguez.

Perez performing with his band Pearly Queen in the late '70s. Courtesy of Rudy Perez

Though Perez names many mentors in his book, he tells NBC News that one stands out. The late Tom Dowd, an Atlantic Records recording engineer and producer, made a big impact on Perez because he was ahead of the curve on one of the most crucial changes in the past 40 years — the evolution from analog to digital recording.

“Before he got into music, he was one of the physicists who invented the atomic bomb,” Perez says about Dowd, who devised various methods for altering sound after the initial recording.

“In 1996, he’s the one who told me to get Pro Tools ... Before this editing tool, what we used was a razor blade, you literally cut the tape. Now, it’s like cutting and pasting in Word," Perez says. "People like me who went through that whole era, we could really appreciate what we have now.”

Perez's most challenging editing feat was for Natalie Cole’s Spanish-language album, “En Español,” for which he synced a duet with her and her late father, Nat King Cole.

“In the recording world, this feat was the equivalent of the moon landing,” Perez writes about the hit 2013 album.

Perez and Natalie Cole had discussed working on a gospel album next, but “En Español” turned out to be her final recording before she died. However, it has all come full circle, he says.

“Sam Moore and I are working on a gospel album now … By November, we should have it done. He’s singing better than he ever did in his life,” Perez says about the 83-year-old soul and R&B singer. “I’m also working on a reunion tribute album for José Feliciano — with a lot of big stars in it.”

Perez reflects on the fact he can still remember being young and having big dreams.

“I made a few bad decisions, but always somehow, my love and passion for music always rescued me — it always did,” Perez said, crediting his parents' courage and the “kind heart” of the United States, the country that took his family in.

Now, Perez wants to influence people "to do good."

"The world is full of hatred, and I want to make it a positive place. I want to let people know that if they go in the right direction, so many things can happen to you," he said. "I think that is the focus of this book.”

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.