Last year’s death of “Titanic” composer James Horner in a small-plane crash shocked and saddened many of his colleagues, including director Antoine Fuqua, who had recently finished “Southpaw” with the two-time Oscar winner, and had planned to do “The Magnificent Seven” with him.

So a few weeks after the tragedy, when Horner’s longtime musical collaborator Simon Franglen showed up on the film’s Louisiana set with “a gift from James,” the director was stunned as he found himself listening to 15 minutes of music that the composer had already written for the film, even before shooting started.

“I was overwhelmed,” Fuqua confesses. “It took me a while to get it together, it was just so beautiful and so powerful. I called my sound guy and said, ‘Get the biggest speakers you can and put them on the set right now.’ I walked out and played it for my crew. People clapped and cheered, and some had tears in their eyes. That music inspired us to push forward.”

Horner, it turns out, had so much work lined up that he decided to start earlier than usual on “Magnificent Seven,” based on just a reading of the script. (Other films on his list: “The Great Wall,” “Hacksaw Ridge,” and James Cameron’s “Avatar” sequels.) After Horner died, Franglen — a Grammy-winning producer who worked for two decades as Horner’s synthesizer programmer, arranger, and score producer — took the composer’s piano demos, done only weeks before, and, along with recordist/mixer/composer Simon Rhodes, developed them into a suite, which he recorded for Fuqua.

“There were several themes, a theme for the town, one for the cowboys, and so on,” Franglen explains. “It was about getting a style going, to open a discussion with Antoine.”

Fuqua, and then MGM, gave the go-ahead to proceed with a full score based on Horner’s themes. Franglen reassembled Horner’s team: Rhodes, orchestrator/conductor J.A.C. Redford, and music editors Joe E. Rand and Jim Henrikson.

“I know that you can still hear James in the score. People in the orchestra who had played his scores for 30 years said it felt right. Simon Franglen

“James brought together a group of people that not only worked well together but also liked each other,” Redford says. “We talked about this project and how great it would be to somehow make this James’ final score.”

Creating the necessary 107 minutes of music, however, took months. Franglen supervised the entire process, writing new material as needed and adapting Horner’s original material to fit scenes wherever possible. (The final credit reads “music by James Horner and Simon Franglen.” Rhodes receives an “additional music” credit.)

Guitarist George Doering and ethnic-woodwind player Tony Hinnigan — two Horner regulars whose colorful work was featured in “The 33,” one of Horner’s final 2015 scores — contributed their unique sounds. A trio of singers added wordless vocals for especially wrenching moments, another Horner trademark. Franglen tortured two banjos to create an unnerving sound for the villain (played by Peter Sarsgaard).

But the bulk of the score — often muscular, ultimately heroic — was played by an 80-piece Hollywood orchestra, many of whom had played on previous Horner scores, including “Titanic” and “Avatar.”

It was impossible to ignore Elmer Bernstein’s iconic “Magnificent Seven” theme from the 1960 original, so it makes an appearance at the end of the film.

“That was tricky for Simon, and for all of us,” Fuqua says.

Notes Franglen, “It makes a statement, and it’s appropriate where it is.”

Franglen adds that the most important thing to Horner was “the sense of music being the soul of the film. I know that you can still hear James in the score. People in the orchestra who had played his scores for 30 years said it felt right. Everybody came to this from a sense of love for James and what he’d done for film music.”

Adds Redford, “James was a composer with a unique voice — one that could be applied to dozens of different films and still bring heart and beauty to those scores.”

Fuqua, who credits Horner’s support for his making the film in the first place, dedicated the movie to the late composer. “It was an unlikely friendship,” he concedes. “We were like the odd couple: I’m kind of aggressive and he was this quiet intellectual guy. He still saw movies with the eyes of a kid. I loved the guy. [His death] was a great loss. But he can live on through the music.”