Wright has been working on the SXSW smash and soon-to-be summer blockbuster for 22 years.

Twenty-two years ago, writer-director Edgar Wright was constantly listening to the album “Orange” by the rock group The Jon Spencer Blues Explosion.

“The first track on the album, ‘Bellbottoms,’ which is a fantastic rock track, I just listened to that song over and over again,” said Wright at a Q&A during the 2017 SXSW Film Festival. “I don’t know what it was, but I just thought that would make a great car chase song.”

Wright laid in his bedroom listening to the song on repeat, visualizing a car chase set to “Bellbottoms.” He also started coming up with the idea of a character: a getaway driver for a bank heist, who cannot do his job properly without the right music playing.

That core idea is the premise of Wright’s new film, “Baby Driver,” which premiered this weekend at the SXSW Film Festival to rave reviews and will be released by Sony on August 11. Wright wouldn’t sit down to actually write the script until 2010, but that germ of an idea is something he’d develop over two decades.

“I didn’t really know when to start writing it [because] you don’t really have car chases in the UK, London in fact has sort of become car chase proofed,” said the British filmmaker. “If you have ever driven around London and seen the amount of one way systems…they basically rubbed out all car chase crime. In fact, if you get bank robberies in the UK, they’re using scooters.”

For that reason, Wright instinctively thought of the film as being set in America. In 2002, he decided to test out some of his ideas in a music video for the band Mint Royale.

“I sort of used my opening scene for that video,” said Wright. “At the time, I was annoyed at myself for doing it, because I shouldn’t waste this idea on a music video.”

Wright said the video had a long shelf life because it stars Noel Fielding (“The Mighty Boosh,” “Never Mind the Buzzcocks”), who afterwards would go on to become a well-known British comedian and actor.

“It was one of those videos that kept coming around, the actor in the video became famous afterwards, so it was one of those videos that reappearing throughout my career,” said Wright.

Before writing, Wright started researching cop car chases in Los Angeles (and later Atlanta, when the film switched locations) to find out what techniques were used by successful getaway drivers.

“In a lot of action films, people are driving muscle cars or vintage cars, where as in reality, getaway drivers would choose commuter cars and find ways of blending into freeway traffic as quickly as possible,” said Wright.

The filmmaker even went so far as to start interviewing ex-cons and law enforcement, explaining he wanted the film’s action sequences to feel grounded in reality.

“I really wanted people to get the feeling of what it would be like to be a getaway driver in the middle of a pursuit,” said Wright. “Not everybody fantasizes about robbing a bank, but I think most people have that fantasy of being in a high speed chase.”

In his previous films. Wright has played with choreographing scenes to music. “Baby Driver” is an attempt to take this to another level.

“I always have so much fun doing those sequences that I basically came up with this movie as a way of doing that for the entire movie essentially,” said Wright.

Wright emphasized that it wasn’t simply a matter of cutting the chase scenes to music, but writing, shot listing and then choreographing the scene with a stunt coordinator, cinematographer, actors and an actual choreographer to get the precise timing and movement in lock step with each specific song.

“It’s sort of like a musical in a way,” said Wright. “I took that premise that Hong Kong movies are musicals that have about five big numbers, it’s five action set pieces, a song for each.”

“Baby Driver” premiered at the 2017 SXSW Film Festival and will open nationwide on August 11.