The contrast between this summer's two uber-spectaculars – the diamond jubilee concert and the Olympics opening ceremony – couldn't be starker. At the former, Gary Barlow produced a musical vision for austerity Britain where geriatric crooners rubbed shoulders with talent-show alumni at the end of the Mall. Madness were the risky prospect.

At the latter, something far more radical happened. The floor of the Olympic stadium was torn asunder to the sound of thundering techno and the Queen watched as the union flag was hoisted to a record by one half of Fuck Buttons. Later, Team GB were afforded the most dignified and electrifying entrance possible accompanied by David Bowie's Heroes – a record that resonated like a national anthem beamed from an alternate universe.

Danny Boyle made a shrewd choice when he approached the electronic duo Underworld to offer the job of soundtracking Isles of Wonder, the opening ceremony show. It was a move calculated to make the nearly four-hour stage production peerless.

"From the very first meeting," says Rick Smith, musical director for Underworld, "Danny was determined to 'break the curse' that accompanied shows of that scale. If there were elements that made us laugh or things that we loved for whatever reason, we kept them. We threw the supposed rulebook out, avoided the rubbish."

Smith's relationship with Boyle extends back to the mid 90s, when the director approached Underworld about using a little known B-side (Born Slippy: Nuxx) as part of the soundtrack to his second movie, Trainspotting. So inspired by their music was the director, he had originally cut the film to the band's debut LP Dubnobasswithmyheadman. When released as a single in the movie's slipstream, Born Slippy: Nuxx sold more than 750,000 copies in the UK. Following further contributions to the Beach and the sci-fi film Sunshine, Boyle called on the band to create an enveloping soundscape for 2011's National Theatre production of Frankenstein.

"As the play ended, Danny called saying he wanted to talk about the opening ceremony. I headed to the meeting thinking I'd turn it down. Frankenstein was a struggle, if I'm honest; it wasn't the kind of workload I'm used to. Within a minute and a half of being in the meeting, I said: "I'm in. Yes, please." And that was down to Danny. Working with him, I saw what Frank Cottrell Boyce [Isles of Wonder's writer] describes as Danny's 'courageous faith in human nature'. He'd asked me so he must have thought I could do it."

Soon after Smith's appointment as musical director in the summer of 2011, it was clear that the show's music was fundamental.

"Frank talked in the Observer about the galvanising effect that the music had on the team and I definitely had a sense very quickly that sound was an ingredient that – if I got it right – was going to gel lots of disparate elements. As for trying to work out what music would go in … what would most people do given that scenario? They'd say: 'Let's tick some boxes.' But then you end up getting overwhelmed by all those boxes that need ticking. Our culture is so, so rich; you can't even begin to tick those boxes. So you look for defining moments and you follow your heart."

"I started on the Pandemonium section in June 2011 when the band was touring. Danny wanted to frighten people. He was certain that by the end, people had to be going: 'Christ, you can't possibly do that to us for the next three hours.' All the way along, he'd leave you with a sentence like that. That's the kind of direction that leaves you empowered."

One listen to And I Will Kiss – the score for Pandemonium – and you hear Underworld in RealD. It's a techno band afforded access to Abbey Road studio 2, Dame Evelyn Glennie, the Grimethorpe Colliery Band, the London Symphony Orchestra and 1,000 volunteer drummers; 17 minutes of gloriously euphoric controlled chaos. Initial conversations around the arrival of the Olympic torch – the section subtitled Caliban's Dream – were similarly driven more by emotional response than musical style.

"Frank and Danny put forward beautiful, transcendental poems by people like WH Auden, Thomas Nash, Philip Larkin. They set the tone for Caliban's Dream. Very early on Danny encouraged me not to think in terms of Eye of the Tiger for the final stages; we weren't looking for anything testosterone-fuelled. Those poetic ideas that we had talked about initially just seemed so beautiful; we wanted to draw them in to the story of the torch. Karl [Hyde, Smith's partner in Underworld] spent a long time working with those words to make them flow, helping avoid all the possible cliches we could fall prey to."

On the night, Smith watched the show unfold from a control room.

"I spent the night cueing volunteers. I finally went to find my family when the athlete's parade started, figuring everything was beyond my control by then. That was a nice feeling. I had about 20 minutes shouting and cheering before I left to head back inside for the last section. On the way, I thought I'd nip out for a quick cigarette. As I was wandering outside, I heard over the Tannoy "Zimbabwe" and I thought, "Z … Z … oh shit that's the last country before Team GB!" I sprinted back in, arriving just as Heroes came on to see the place just explode. I ran halfway round the stadium to get to the control room. When I fell inside, we just started screaming our heads off like kids, singing along so badly. It was a moment of total and utter joy."

With the Games in full swing, Smith is allowing himself some headspace for the first time in more than two decades.

"I don't know what I'm doing next. It should be scary but it's an absolutely beautiful feeling," he says, laughing. "Many years ago, I had dreams about being in a band and playing a stadium. And I did in 1989: we did with Eurythmics. That experience was such a bitter disappointment, my world fell apart. This was entirely the opposite. I couldn't ever have dreamt it. And it came true. How does that happen?"