There’s a classic sound to heist films, especially of the ’60s and ’70s – a little jazzy, a little stealthy, occasionally raucous and wild – and composer Daniel Pemberton cleverly channels it throughout “The Bad Guys,” the DreamWorks Animation action comedy that opens today.

“The film in some ways is an homage to classic caper movies,” says the English composer, “and it’s a world I really love playing in. You get to be really bold: big breaks, big brass sections, big tunes and big grooves.”

Pemberton’s high-energy music sets the mood and drives the action in Pierre Perifel’s animated adventure about a notorious criminal gang (a wolf, a snake, a piranha, a shark and a tarantula) that considers going straight after they cross paths with a guinea-pig philanthropist and their red-fox governor.

“At its core, it’s a very joyous score, even though there’s sneakiness, tension, all that kind of stuff,” he notes. He cites Quincy Jones’ “The Italian Job,” Lalo Schifrin’s “Bullitt” and David Shire’s “The Taking of Pelham 1-2-3” (all written between 1968 and 1974) as early inspirations.

“The Bad Guys” contains Hammond organ, fuzz guitar, bongo drums, Moog synthesizer, which reference that period. But it’s also a very contemporary sound, with big beats, a full orchestra and a fast pace throughout. There’s never a dull moment in the film or the score.

The choice of musicians was key, Pemberton says. “It was a bit like putting your own heist gang together,” he says. “You’ve got the safecracker, the getaway car driver, the muscle guy. I’ll do that with a band: I know a guy who’s great at Hammond organ solos, a great guitarist, a great drummer. That’s the way to approach a score like this.”

It took time. In fact, the “Bad Guys” score required 4,000 individual takes, a record for the Oscar-nominated songwriter whose recent career includes such high-profile titles as “The Trial of the Chicago 7” and “Being the Ricardos” and who also did the live-action caper “Ocean’s Eight.”

“I love to get the best performances I can out of people,” he says. “I might spend half a day recording a bass line. The more detail I can put on each performance, the better it can be,” although he also admits that “by the time the film’s finished you’re like, can anybody even hear this?”

Spicing up the score are unique and unexpected sounds, including the Indian bansuri flute, which is the voice of the Crimson Paw, a fellow thief who comes to the aid of the imprisoned gang; and the Japanese tashiogoto, an unusual stringed instrument heard in the main “Bad Guys” theme.

Professor Marmalade, the good-guy guinea pig, gets a Bach-style piano prelude (“he’s very pleased with himself, and there’s a cleverness about Bach preludes,” explains Pemberton), and there is a classical-guitar motif for the bad guys going “good” (temporarily).

He also wrote two songs, one of which (“We’re Gonna Be Good Tonight”) is the focus of an early heist scene. “We had to have a song that could start as a distraction for the audience, then needed to turn into a message about how the audience needed to adjust their opinions about how they looked at people, then into a song that was so much fun, so infectious, that you couldn’t help but dance to it.”

Pemberton and lyricist Gary Go figured it all out in a single evening walk from Pemberton’s London studio to Big Ben and back home. “It was magical, like your fantasy of being a Hollywood songwriter, hanging out with your mate, walking along the Thames at night and singing into your iPhones,” he says.

He also collaborated with the English band The Heavy on the end-title song, “Brand New Day. “We needed to send The Bad Guys onto the next chapter of their story,” he says.

“I’m always drawn to projects where I can have enough space to be original,” adds Pemberton, whose only prior animation experience was the acclaimed “Spider Man: Into the Spider-Verse.” “I thought this could really be a fun way to spend a long time, and it was. This was genuinely one of the most pleasurable moviemaking experiences I’ve ever had.”