Normally the content of a movie dictates the music. Strings swell as the reunited lovers kiss and piano keys quietly plink during the weepy deathbed scene. But the opening sequence of “Baby Driver” is built — with impeccable attention to detail — around Jon Spencer Blues Explosion’s 1994 jam “Bellbottoms.”

During the song’s two-minute buildup, a getaway driver listens to the track while sitting outside a bank where a robbery is in progress. He lip-syncs along, beats the steering wheel like a bongo and turns on the windshield wipers, which glide across the glass in sync with the rhythm. When the robbers return with the loot, the song kicks into gear, so the driver does, too. He peels out when the snare drum builds and barely avoids two cars, which crash as the kick drum hits. Jon Spencer sings, “I’m gonna break,” and the driver brakes; then a distorted guitar riff starts, commingling with the faint reverberations of a police chopper overhead.

Movie music in recent years has often become a predictable afterthought. But for British writer-director Edgar Wright this tune was where it all began. Listening to “Bellbottoms” on a cassette tape more than two decades ago, Wright, now 43, could see the cinematic possibilities. The long intro, the variations in tempo, the kinetic climax: All of it seemed perfect for a car chase that the director has finally brought to thrilling life.

And it’s not the only confluence of sound and image. Sitting in a Washington hotel the morning after an ecstatically received screening, Wright explained the process of choosing the music for his movie.

Or, rather, figuring out the movie for his music.

“It’s definitely a weird way to work,” Wright admitted.

Director Edgar Wright, center, with director of photography Bill Pope, left, and Ansel Elgort on the set of “Baby Driver.” (Wilson Webb/TriStar Pictures)

The title, also the name of a Simon and Garfunkel song, is quite literal. Baby (Ansel Elgort) is the young, gifted driver who capably evades the cops in that first scene. He’s stuck working for a criminal kingpin, Doc (Kevin Spacey), because of a long-ago debt. To manage a terrible case of tinnitus, he keeps headphones jammed in his ears, drowning out what Doc calls the “hum in the drum” with music.

The plot has some familiar notes, including a big heist, a stew of peculiar characters (played by Jamie Foxx, Jon Hamm and Flea, among others) and a fledgling relationship between Baby and a too-cute-for-words diner waitress named Debora (Lily James). But the music — and the painstaking integration of action and rhythm — transforms a commonplace narrative into an exhilarating experience.

“I’m not usually one to watch action films,” admitted the movie’s choreographer, Ryan Heffington, known for Sia’s “Chandelier” video, viewed 1.6 billion times on YouTube. “But on paper, it was thrilling.”

Heffington had plenty to work with considering the steady stream of songs. For years, Wright added to an iTunes playlist named “Maybe Babies” that peaked at 700 tracks. He managed to whittle that down to 35. The songs conjured specific, sometimes incongruous images in his mind. He may be the only person to think that Barry White’s “Never Ever Gonna Give You Up” would be the perfect auditory backdrop for a menacing showdown — but somehow it works.

“That’s a great sort of sexy love jam, but it has this amazing, strangely sinister intro where it sounds like it’s from ‘Dirty Harry’ or something,” Wright said.

“Hocus Pocus” by Focus, meanwhile, has a guitar instrumental with some crazy breakdowns — a bit of yodeling, a flute solo — but it also has a lot of stops and starts.

“With something like that, I was thinking this is a great foot-chase song because you’re running, running, running and stopping,” he said. “You let the structure of the song dictate the action.”

Montreal-based DJ Eric San, better known as Kid Koala, collaborated with Wright on a couple of tracks.

“Some of those songs, if you just heard them that loud, they’d already give you goose bumps,” he said. “I think Edgar just takes it up a notch in terms of how well it’s integrated. It takes advantage of the fact that the music already has lifts in it, and then kind of augments that by synchronizing with the acting. It has this beautiful effect.”

Elgort and Lily James. (Wilson Webb/TriStar Pictures)

In 2008, between making “Hot Fuzz” and “Scott Pilgrim vs. the World,” Wright started remixing songs — adding gunshots, among other things — with DJ Osymyso. It was easier for Wright to nail down the music first. The hardest part was getting all of his ideas into a coherent screenplay.

“It’s having this vision of what it looks and sounds like and trying to write that down and get it across on the page,” Wright said. “Sometimes you see [screenwriters] literally write ‘awesome car chase follows,’ but I wrote it out like it was a musical beat sheet.”

His meticulous screenplay describes the music, dialogue and action simultaneously.

One of the movie’s most memorable songs is actually a remix of dialogue. Baby is an amateur DJ, and he spends his non-driving hours playing back tapes he secretly records of conversations with Doc, among others, and setting the words to music. That’s where San came in.

The DJ has worked on movies before, including “The Great Gatsby” and “Looper,” but this was a very different experience.

“With other movies, everything was finished” when he arrived, San said. “It was all polished, and they just needed certain things done to the music.”

Elgort, in the car, with Eiza Gonzalez, Jon Hamm and Jon Bernthal in “Baby Driver.” (Wilson Webb/TriStar Pictures)

But San, who also worked with Wright on “Shaun of the Dead” and the musically driven “Scott Pilgrim,” was much more involved on “Baby Driver.” Wright sent him the script and described Baby’s character — a somewhat naive kid who essentially lives off the grid, given his criminal occupation. He’s not the type of guy who has a smartphone or laptop, just a lot of low-fi gadgets and outdated iPods he might have picked up at a pawnshop.

Luckily, San has “a veritable landfill of odd equipment” in his studio. One of the machines he used will be familiar to anyone who’s seen “Ferris Bueller’s Day Off.” Another was an old recording device used in classrooms. The finished product sounded suitably amateurish.

“Most DJs who know me would be like: What’s he doing? Is he scratching with his feet on this one?” San said with a laugh. But that was what the scene required.

San flew to Atlanta, where the film was shot, to teach Elgort how to use the equipment and make sure it looked right in the scene where Baby creates his songs. That extra step is a testament to Wright’s specific vision. Heffington, too, was involved in everything from the choreography of a highly technical extended tracking shot, which Elgort had to shoot 28 times, to scenes where Baby simply taps his fingers on a desk.

“The fact that it’s all timed out feels a little hyper-real but it’s still natural,” Heffington said. “It’s rhythmic, it’s intricate and reality is pushed a little more — but in a really stylistic way.”

Baby Driver Rated R. At area theaters. Contains violence and obscenity throughout. 113 minutes.