The soundtrack to writer and director Edgar Wright’s heist thriller Baby Driver puts the pedal to the metal.

The Shaun of the Dead director picked 30 tracks that move to the beat of young, getaway driver Baby (The Fault in Our Stars actor Ansel Elgort) but there was one song pivotal to the film’s creation.

“In a sense the music inspired the movie because the first song in the movie — Bellbottoms by the Jon Spencer Blues Explosion — gave me the seed of the idea,” Wright says on the phone from Sydney.

“I basically listened to that song and I imagined this car chase, so it’s the closest thing I guess I have to an action-movie version of synaesthesia.

“I would listen to the song and I would envision this car chase and at some point I couldn’t listen to the song without thinking of a car chase.

“Then I had to think up the movie that went with that and that became the idea of ‘Well what if Baby is a getaway driver that has to pick the songs’ — you know, that he is sound tracking his own life and he is essentially coming up with the perfect score for the perfect score.”

The film centres around orphan Baby who has tinnitus, a whine in his ear, caused by an accident when he was a child. The self-conscious 20-year-old listens to music to drown out the whine.

Director Edgar Wright and Ansel Elgort on the set of Baby Driver. Picture: Wilson Webb

He has tracks for driving criminals around including the Damned’s Neat Neat Neat and Queen’s Brighton Rock, he walks down the street to Bob & Earl’s Harlem Shuffle. Falling in love with Debora (Downton Abbey’s Lily James) adds T. Rex’s Debora and Beck’s Debra to his track list.

The eclectic soundtrack to Baby’s life is a reflection of the music Wright likes.

“I think from an early age it started with my parents’ very small record collection,” he explains.

“Then when I was like a pre-teen, teenager I listened to a lot of contemporary music on the radio but I was always listening to older music.

“I think my teenage years were sound tracked by Bowie and Roxy Music and Queen and Motown and Stax.”

When he was about the age of his titular character Wright had the idea for the film.

“Well 22 years ago I was 21 years old and hadn’t had a movie out and certainly didn’t have any muscle to call up a studio and say ‘Hey give me millions of dollars to make my heist movie’,” he jokes.

“The truth of the matter is I didn’t really say it out loud, I’ve been thinking about it for that long.

“Fifteen years ago I did a music video that was like a dry run for the opening scene but it wasn’t even until 10 years ago, after Hot Fuzz, that I voiced aloud to my producers ‘I want to do this movie called Baby Driver’.

“I finished the script in 2011. I went off to make another movie and then it was 2014 when I said ‘OK Baby Driver is the next movie’ and then we spent the past three years making it.”

Wright thinks about 95 per cent of the music he wrote into the first draft is still in the movie.

“The only songs that fell out were like dance songs ... it wasn’t a case of money, the artists had just not cleared the songs and therefore it was an unusable track,” he says.

The music drives the pace of the film and choreographer Ryan Heffington was brought on board to co-ordinate the action to the beat of the music.

“We basically had playback on set the entire time, so either we’re playing the music out loud so everybody can hear it, or Ansel Elgort is listening to it on his headphones or sometimes you use this thing called the earwig where the actors can hear music on these little transistors in their ears but you can still record dialogue,” Wright explains.

An all-star ensemble cast was assembled for the film including three Academy Award winners; Kevin Spacey (best supporting actor The Usual Suspects, best actor American Beauty), Jamie Foxx (best actor Ray) and Paul Williams (best original song Evergreen).

“Kevin was not in the mix at all because he was unavailable ... then I think he was supposed to be doing a play which got postponed until this year so suddenly there was a moment where they said ‘Kevin Spacey is now available’,” he says.

“I said ‘Well he’s amazing do you think he’d do it?’

“They sent him the script and then maybe about 48 hours later they said ‘Kevin loves the script, can you fly to Baltimore to meet him?’

“I said ‘Of course’. So I was on a plane that night and I met him the next day and the day after that he is in the movie.”

Spacey is crime boss Doc whose rotating team of robbers includes psychopath Bats (Foxx) and Bonnie and Clyde-style lovers Buddy (Mad Men’s Jon Hamm) and Darling (Eliza Gonzalez star of From Dusk Till Dawn: The Series).

“Jon is the only member of the cast that I knew before I started doing the movie so I had written it with him in mind ... and it was a thrill to be able to offer it to him because we’ve been friends for the past nine years,” Wright says.

Elgort is a musician and dancer so on paper he was perfect for the role though initially Wright wasn’t so sure.

“I’m 5’7” (1.7m), I always imagine my heroes to be shorter,” he says. “Ansel was like ‘I never imagined Baby to be 6’4” (1.93m) but I guess he is’.”

His physicality wasn’t quite what the Scott Pilgrim vs The World director had in mind but the baby-faced Elgort’s age was perfect for the role.

“It was definitely a huge benefit to have a young actor play a young part,” he says.

“It wasn’t like you were casting a 29-year-old to play a 20-year-old. You’re casting a 20-year-old to play a 20-year-old and that I think had huge benefits.”

Reinforcing the movie’s musical roots, Wright also asked musicians, including Red Hot Chili Pepper’s bassist Flea, to take part.

“Flea is somebody that I knew through mutual friends and in fact we hadn’t cast that part and we went to a dinner and Flea happened to be there,” he explains.

“I leant over to my producer Leo (Thompson) and said ‘Flea should be in the movie’ and then we offered it to him the next day.”

Killer Mike and Big Boi make very brief cameos in the movie along with Sky Ferreira as Baby’s mum.

“I’m a big fan, I really liked her first album so it was great to get her involved and then Paul Williams (who plays The Butcher) I’ve been a fan of his for decades so it was just a thrill to give him a part,” he says.