Dig just past the shiny surface of today’s mainstream pop music, and you might find yourself asking questions like, “Why does it take seven people to write a song that sounds like it came from a computer?”

In the case of the current smash hit “The Middle” by Zedd, Grey and Maren Morris — which has topped Billboard’s pop radio airplay and dance music charts while collecting hundreds of millions of digital streams on services like Spotify, YouTube and Apple Music — the process went far beyond even its three lead artists and seven credited songwriters.

Other WRAL Top Stories

What began as a demo by a behind-the-scenes Los Angeles studio team and a young wallflower singer from Australia took more than a year of fiddling between the germ of the idea and its Top 40 debut, a creative roller coaster that included three distinct waves of musical production, 14 prospective vocalists, a corporate tie-in and a video premiere during the Grammys.

Lennon-McCartney this was not.

But while “The Middle” and other would-be major hits of its ilk may strike some purists (or snobs) as cynical — compositions by committee, designed for mass appeal and maximum pleasure — they are also meticulously constructed, deeply collaborative and often inventive, squeezing multiple moods and genres into a three-minute package that can somehow feel universal.

In the inaugural “Diary of a Song,” a new video series from the pop music team of The New York Times that pulls back the curtain on how music is made today, we tracked the writing and production of “The Middle” through voice memos, demo versions, text messages, emails, interviews and more provided by those behind the track. The full video is at nytimes.com/music.

The material revealed an intricate dance between no fewer than eight collaborators — including, ultimately, an incongruous pair: the producer-DJ Zedd and the pop-country singer Maren Morris — all of whom put egos and personal preferences aside in service of the sonic whole. Below, in edited excerpts from their own words, is how the song came together.

— The Players

Zedd, born Anton Zaslavski, a dance-music DJ and producer known for his pop-star collaborations.

Morris, a country singer and songwriter based in Nashville, Tennessee.

Grey, the electronic producer brothers Kyle and Michael Trewartha.

Sarah Aarons, an Australian songwriter who focuses on lyrics and melody.

Stefan Johnson of the Monsters and the Strangerz, a five-person songwriting and production team based in Los Angeles also featuring Marcus Lomax, Jordan Johnson, Alexander Izquierdo and Clarence Coffee. JOHNSON: She’s one of the only writers who can write a whole song in an hour or 45 minutes, and it feels special. A lot of people are chipping away, but she is just fluid consciousness. You put a four-bar loop on, you press play, and literally the chords will just go over and over, so she can just get in her own head space. She spent maybe 10 minutes, went in the booth and laid it. AARONS: I was just humming it, or just singing nonsensical things. It started forming into “[singing gibberish] meet me in the middle,” and then they were like, “Oh, that’s sick!” Then I just was like, “Oh, I’m losing my mind just a little.” That kind of kicked it off.

JOHNSON: That’s the first time we heard the hook, ever. Literally right after the word “little,” all three of us just screamed with excitement. It definitely felt special.

(Aarons would go on to write a pre-chorus section — “So pull me closer/why don’t you pull me close?” — and verses for the song that day, though she would later adjust the lyrics and melody in Australia. After adding additional production flourishes, including the vocoder vocal effect on the chorus, the Monsters and the Strangerz team knew it had a hot demo to shop to bigger artists.)

KYLE TREWARTHA: We get sent a lot of demos, but there’s a few writers where we’ve really loved basically everything they do, and Sarah’s one of them. We were instantly like, “This is going to be huge — there’s no question.”

ZEDD: For somebody who produces a demo, it just has to be put on a really nice plate, with really nice lighting, so when you get it, you want to eat it. I first heard the Monsters’ demo — it must have been March or April. I was like, “If done right, this could be a huge smash.” KYLE TREWARTHA: We try to look for sounds that you’ve heard before, but you don’t ever really hear in a song. So, like, everyone watches “Game of Thrones,” and there’s all these melee combatlike sounds throughout: that kind of stuff.

MICHAEL TREWARTHA: It was cool to be able to use this medieval ax whipping noise in such an open and dry space where everyone can hear it.

KYLE TREWARTHA: A few months into the process, we had something that we liked, but it wasn’t absolutely perfect by any means. We played it for [Zedd], and he was like, “This is so good, but I can hear where I could take it.” ZEDD: Where it really caught my attention — although the verse was great — was the chorus. Especially the first time you hear it, it had to be shocking. So the biggest thing was deleting everything other than the vocal.

(With the track starting to coalesce musically, the producers knew the song was a potential single. All they needed was the right singer. Everyone agreed on one thing: They loved Aarons’s vocal on the demo.)

AARONS: Zedd, every time he sees me he’s like: “Are you an artist yet? Because you’re going to sing one of my songs.” I’m like: “No! I’m not! Never going to happen.” I don’t like the idea of humans knowing who I am. I never want to be in the public eye.

ZEDD: Sarah wasn’t an option, so it was a matter of, “Well, I can’t go to a mediocre voice — it goes against everything I stand for.” I’m looking for somebody to sing it with the same intention.

KYLE TREWARTHA: We went through 14 different vocalists, and most of them just didn’t fit right because this song has a really large range. The verses are pretty low for a girl, and the choruses at the end are really high.

JOHNSON: We get the cover art, we get the mix, we get the whole thing, and everybody’s like, “Approve, approve!” We’d been so stressed about the song already, but it was finally done.

AARONS: I got a phone call on like, New Year’s Day or the 2nd, that’s like, “OK, don’t freak out, but this is all falling apart.” ZEDD: Maren was the absolute best thing that could have happened to us. I had never heard her music until I heard her demo. I looked her up and she’s a country singer, but to me it absolutely doesn’t matter what type of music you make because I’m not looking for a face in a vocalist, I’m not looking for somebody to shine; I just want to find the perfect voice to carry the song. (Just after the holidays, with the release date looming on Jan. 23, Zedd went to Nashville to record Morris.)

MORRIS: I had played this New Year’s Eve show in Nashville out in the freezing cold, and my voice blew out. I had to take a steroid shot just to get my voice back to do the vocal that next day.

ZEDD: I flew in and had to fly out that same night. We were done after like 3 1/2 hours, which honestly is really fast for me. I typically take six, seven hours to record a vocal until the singer doesn’t have a voice any more.

MORRIS: He clearly had a vision for it, but he was also really great about letting me do my thing on it, too. I loved the original so much I didn’t want to mess with it, but I also wanted to bring my own flavor.

KYLE TREWARTHA: It was just nice to hear not only someone that sang it so well, but someone who sounded fresh on it, and gave it a different character. The fact that she sounds like she wouldn’t normally be on a song like this is such a positive.

(As Zedd rushed to complete the final mix, there were also photo and video shoots to finish before the Grammys. But when the song finally made it into the world, the reaction was immediate.)

ZEDD: “The Middle” has been the fastest-rising song for me I’ve ever had. Each week, you could tell the progress was exponential. There was a lot of back and forth, and I don’t think I’ve ever worked on a song for that long.

JOHNSON: If you think about all the songs written in the world every day, if you have a hit, it is a full-blown miracle. The fact that there was so much intent behind this one and so many people — it’s like the Little Engine That Could.