May 14, 2015 6:16 AM EDT

The producers of Pitch Perfect, a charming little musical comedy about the idiosyncratic world of collegiate a cappella, had no idea that their 2012 film would gross $113 million worldwide, spawn a platinum-selling soundtrack and turn star Anna Kendrick into an unlikely chart topper. So for the sequel, out May 15, they knew the songs were as important as the story. Most movie soundtracks happen after the fact, with music supervisors largely working in postproduction. But for Pitch Perfect 2, a team of 20 people, including producers, arrangers and editors, selected almost 60 songs and began the process of recording all-new versions before cameras started rolling.

Many of the songs in Pitch Perfect 2 are mashed up with others to form one-of-a-kind medleys, so choosing them often came down to math. If the beats per minute of two songs didn’t match, arrangers had to rework the tempos or find other options. For the film’s riff-off, a battle royal between rival a cappella groups, director Elizabeth Banks wanted the songs in each round to get progressively faster to build the tension. Getting permission to use the music was also a numbers game: certain songs cost more to license than others, and some artists self-eliminate by asking for too much money. “The business and the mechanics of that can get very, very complicated,” says Mike Knobloch, president of music for Universal Pictures.

The cast didn’t have any formal role in the process, though that didn’t stop actors from giving their input. “I sent many emails to the music team, which I have no business doing,” says Kendrick, whose song “Cups” from the first film peaked at No. 6 on the Hot 100. “Sometimes you feel strongly and can’t help yourself. I just shouldn’t have anybody’s email address.”

Despite Kendrick’s success, producers were wary of forcing a similar breakout moment in the sequel. “It’s like lightning in a bottle,” executive music producer Julianne Jordan says. They may end up with a hit anyway: when the script called for newcomer Emily (Hailee Steinfeld) to write an original song, Pitch Perfect 2 recruited pop stars Sia and Sam Smith to help compose “Flashlight,” an empowerment anthem that met the movie’s No. 1 criterion. “Everything has to have a sense of fun,” Banks says. “That’s the Pitch Perfect brand: bringing together a very quirky group of people.”

This appears in the May 25, 2015 issue of TIME.

Write to Nolan Feeney at nolan.feeney@time.com.

Read More From TIME

Related Stories

EDIT POST