Keanu Reeves and Alex Winter return as Bill and Ted for another adventure in “Bill & Ted Face the Music,” on-demand and in theaters on Aug. 28, and their quest this time is to find a song they wrote and save the world through music.

But what’s the story behind that song? It took a village to put it together and numerous passes to bring the eight-minute spectacle together. Spearheading the process was music supervisor Jonathan Leahy (“Girls,” “Fruitvale Station”).

Below, he breaks down how important it was to find the right guitar shredder and follow in Steven Vai’s footsteps, and how he found the right musicians to accurately riff off the sounds of Jimi Hendrix and Louis Armstrong.

So, no pressure: How did you create the song that saves the universe?
I had a small role in writing the song, but I had more of a creative role because one of the writers had to go on tour and I was entrusted with the ProTools session.

The song had to be Reconformed (a sound editing program through Vordio) many times and some of that fell to me. But the bulk of the song came from writers at Heavy Duty Projects, which is run by [Haim/ Vampire Weekend producer] Ariel Rechtshaid.

Two things jumped out at me. The first and main thing was the air-shredding in the third film. In the second film, “Bill & Ted’s Bogus Journey,” the shredding is famously performed by Steve Vai, who is a legend. We couldn’t take a step down in this film, and we had to maintain the guitar authenticity.

My search led me to guitarist Tosin Abasi, but what sealed his position as the shredder for this movie was when I saw a video of him on tour with Steve Vai. Steve brought Tosin on stage and said, “I’m about to bring someone on stage who represents the next generation of electric guitar virtuosity.” When I saw that video, it was meant to be.

Louis Armstrong features in the film — how did that aspect come together?
I felt tremendous pressure to get the Louis Armstrong horn part, and we were very lucky to get the Grammy-nominated Christian Scott to play the parts.

Christian has a cameo in the film – you’ll see him for just a moment as one of the most important people in the universe. It’s when Bill and Ted go to the future, and you see Christian onscreen for a second, floating in mid-air looking down ominously at Bill and Ted as they’re informed that they need to save the universe.

What did you want the song to be about, thematically speaking, and what was the vibe you were seeking?
We weren’t looking for a song, or themes or vocal hooks that would be big enough and memorable enough. I think the wording that I used when I talked to the artists and producers and managers was, “We’re looking for melodic themes that sound like they can be chanted at a football stadium.”

We listened to a ton of options, and some of our favorite themes came from Heavy Duty Projects. Other themes came from Ray Suen — he’s an old friend of mine and provided the Jimi Hendrix guitar parts. He’s such a monster musician — when you hear Hendrix battling Mozart, that’s all Ray.

Were there any changes in the song process?
Our music editor, Jeff Carson, was constantly adapting to the picture changes, and quickly too. It changed so many times over the months.

As we got closer to the picture being locked, we called it “The Frankenstein” because it came from many different sources, and it was a mess. At that point, Ray was on tour with Lorde, so I had to call someone new. I called a guitarist Joshua Ray Gooch [Shania Twain’s lead guitarist].

We talked about it and how the themes had been written, and where the guitar solo was going to start and finish and how the music needed to be finessed. I asked him if he was up to the challenge, and he said yes.

He brought in a fellow musician, Cory Churko, and together they re-recorded the whole piece. In the end, that piece is almost eight minutes long. The beginning is intentionally messy because everyone is setting up their instruments and tuning them. But Joshua and Cory are the heroes, they produced the bulk of what you hear in that final eight minutes.

And we had Christian and Heavy Duty Projects come back and do some overdubs, but that song was such a big project and a team effort in the end.