Writer and director Benjamin Cleary’s “Swan Song,” which premieres Dec. 17 on Apple TV Plus, straddles the line between science fiction and drama as Mahershala Ali plays Cameron, a dying man who is presented with a choice that could save his family from grief.

Composer Jay Wadley came onto the movie late in the game; there was already a preliminary cut, which meant not only did he get to see Ali’s performance on-screen, but he got a sense of the editing, writing and cinematography. So he didn’t have to play around with sounds and work on music cues theoretically — he could go right in.

Cleary and Wadley’s approach considered Cameron’s inner turmoil as he deals with the pressure of making the decision to have a healthy clone of himself created in a lab to take his place. The musical key to the dilemma was a piano that also features in the story’s plotline. “There were interesting ways to tie in the thematic elements,” says Wadley. He also used a small chamber string orchestra that gave the score nuance and warmth. The intention was to take a step back and not layer the music with a million different pieces.

Wadley added electronics and processed sounds to tie in the futuristic elements of the storyline, but he was careful not to go too far into traditional science-fiction themes. “The film cuts to the core of who we are as people, and that needed to resonate emotionally,” he explains. “Therefore, the score couldn’t be synthetic.”

Cameron takes an anxious journey as his experimental switch nears, and his clone, Jack, wakes up; Wadley incorporated harmonic changes to reflect the tensions that are rising in him. The sound is an unsettling, almost unnerving one. “But it’s never too dark or ominous,” Wadley notes.

Wadley was also mindful about where to place those darker elements. “We didn’t want to create this sense that Jack would murder the family,” he says. “I wanted to avoid all those tropes.”