The muse strikes when it strikes. Still, it's shocking how many of the greatest songs came together quickly – sometimes barely longer than it takes to listen to the finished product. Here are the most memorable examples of such heat-of-the-moment creativity, from that memorable Asia single to a fittingly titled hit by John Lennon.

John Lennon, "Instant Karma!" (1970)

Lennon was already moving on with his solo career in early 1970, even though he hadn't publicly announced his split from the Beatles. On Jan. 27, he woke up with the beginnings of a tune in his head. He'd been inspired by a conversation he had with Yoko Ono's first husband Tony Cox, and the latter's partner Melinda Kendall, about the philosophical concept of "instant karma." Lennon shuffled over to the piano, banged out the song in roughly an hour, called up producer Phil Spector and ventured to the Beatles' studio base at Abbey Road for a suitably fast session.

"It was great," Lennon told Rolling Stone in 1971. "I wrote it in the morning on the piano. I went to the office and sang it many times. So, I said 'Hell, let’s do it,' and we booked the studio, and Phil came in, and said, 'How do you want it?' I said, 'You know, 1950’s.' He said, 'right,' and boom, I did it in about three goes or something like that. I went in and he played it back and there it was. The only argument was that I said a bit more bass, that’s all; and off we went."

Lennon had the song recorded and finished off that same day with help from fellow Beatles bandmate George Harrison, organist Billy Preston, future Yes drummer Alan White and bassist Klaus Voormann. Equally impressive, the single — credited to Lennon with the Plastic Ono Band — was released less than two weeks later. (Apple ad copy featured the line "Ritten, Recorded, Remixed 27th Jan 1970.")

The Guess Who were used to writing quickly: Frontman Burton Cummings claims that two of their signature songs, "These Eyes" and "Laughing," came together in roughly half an hour. But the Canadian quartet still shocked themselves with their chart-topping 1970 anthem "American Woman," which originated from a spontaneous jam session during a show in Ontario. Guitarist Randy Bachman broke a string and wound up stumbling upon the song's snappy riff as he returned his instrument. Hoping to remember the pattern, he invited the band back onstage, and they slowly fell into the groove.

"I look into the audience and there's my drummer Garry Peterson, so I get him to come onstage and we start to play it," Bachman told Songfacts. "Then I see [Guess Who bass player] Jim Kale, he looks up and me and Garry are playing. I call him up and he starts to play the bass riff. And then we get Burton Cummings on the stage, and it's a jam session. We're jamming this riff over and over and over."

Cummings started improvising around the song's main hook, too. "I looked at the girls, and it was not really 'American woman, stay away.' What I was saying was 'Canadian, I think I prefer you. Canadian woman, I think I like you better,'" he told In the Studio With Redbeard. "[They] just didn't seem as fast and racy as the girls in the States. But it came out, 'American woman, stay away from me.' And then, I don't know. I started thinking about — these things just came out: 'war machines,' 'ghetto scenes.' The country was overwhelming me, and I just wanted to be left alone with my Canadian girlfriend."

Since they were jamming material without recording equipment, it wasn't clear that "American Woman" would survive even to the next gig. Luckily, they had a bootlegger in the audience.

"Cassette machines had just been invented at this time," Cummings told Redbeard. "This was 1969. … I'd only seen one two or three times before. There was a kid bootlegging the show that night in the audience, and I saw him standing there with his cassette machine. We told the kid later, 'I'm sorry, we're going to have to confiscate the tape. You can't bootleg our show.' On that tape was 'American Woman.' Had that not all gone down, 'American Woman' never would have happened. We never would have heard it again. We never would have remembered it."

Both Elton John and lyricist partner Bernie Taupin seemed to grab this piano ballad from thin air, assembling one of the purest, most revered love songs during an ordinary day at John's mother's home in the London suburbs.

“The original lyric was written very rapidly on the kitchen table," Taupin told the Independent. "If I recall, [it was] on a particularly grubby piece of exercise paper." The wordsmith passed the baton over to John, and in less than a half-hour, they'd constructed one of their signature songs.

“I remember ... Bernie giving me the lyrics, sitting down at the piano and looking at it and going, ‘Oh, my God, this is such a great lyric, I can't fuck this one up,’" John told Rolling Stonein 2013. “It came out in about 20 minutes, and when I was done, I called him in and we both knew.”

This unimpeachable metal anthem developed as a literal afterthought: Black Sabbath's attempt to fill up a small chunk of space on their second LP. Their label, Warner Bros., was pressuring the band to write a tight radio single, but Black Sabbath — known for their expansive album cuts — weren't comfortable in that territory. "They just wanted a short song," guitarist Tony Iommi said in the ParanoidClassic Albums documentary. "And we've never short songs. It was always [long songs]."

Luckily, inspiration struck in the form of a lightning-quick jam. "We came back from the pub, and we came back into the Regent Sound Studio," drummer Bill Ward added. "And Tony straps his guitar on and starts playing the opening to what is now 'Paranoid.' We're all looking around, and everybody's scrambling."

Top to bottom, the basic track took them less than a half hour. "I think it was about 20 minutes," Ward continued. "Twenty minutes to cook it up and basically have it ready. We had the track, and [singer Ozzy Osbourne] already had some ideas going on with melodies."

Bassist Geezer Butler shaped Osbourne's gibberish placeholders into actual words, drawing on the depression he suffered as a teenager. "I quickly did the lyrics," Butler told Guitar World in 2004. "And Ozzy was reading them as he was singing.” The eventual single wound up peaking at No. 4 in the U.K., making it the biggest hit of their career. Not bad for a last-minute jam.

Greenbaum says he took all of 15 minutes to write the lyrics for a song that spent 15 weeks on the Top 100, becoming the 22nd best-selling song of 1970. A greeting card, a country star, and a memory helped galvanize his thoughts.

“I had come across a greeting card that said ‘Spirit in the Sky,’” Greenbaum later recalled. “And it was American Indians sitting in front of a tipi, with the fire going and being spiritual towards what they had deemed God – which was a spirit in the sky. I think it was the Hopi. So I went, ‘That’s kind of interesting.’

“Then I happened to be watching Porter Wagoner. He had a TV show, and he did a religious song halfway through the show. One particular day, he did a song about a miner that was up in the hills, digging for gold. He hadn’t been to church [or] prayed for, like, years and years. And for some reason, he decided it was time to go back. So he took his viola, came all the way back into town, and when he got to the church, there was a note on the door that said, ‘The pastor’s on vacation.’”

Greenbaum also remembered old cowboy movies where the bad guys “always wanted to buried with their shoes on.” He continued: “All this is starting to connect. I said to myself, ‘Well, I’ve never written a religious song. I’ve written some oddball songs, but some serious song, I can do that.’ I just sat down, and it all came together.”

One of David Bowie's most iconic songs unfolded in a matter of hours over one breezy, idyllic afternoon that sounds like it was too good to be true.

"This song was so easy," he told Daily Mail of the grand Hunky Dory cut, a sort of parody/tribute to Frank Sinatra. "Being young was easy. A really beautiful day in the park, sitting on the steps of the bandstand. 'Sailors bap-bap-bap-bap-baaa-bap.' An anomic (not a 'gnomic') heroine. Middle-class ecstasy. I took a walk to Beckenham High Street to catch a bus to Lewisham to buy shoes and shirts, but couldn't get the riff out of my head. Jumped off two stops into the ride and more or less loped back to the house up on Southend Road."

He wrote the song in a largely empty work space, playing his grand piano beside a chaise longue, "huge, overflowing freestanding ashtray" and a "bargain-price art nouveau screen." He wound up with "the whole lyric and melody finished by later afternoon."

Was it a half hour – or the amount of time it takes to play? ELO mastermind Jeff Lynne has wavered in recalling how long it took him to write this sassy, soulful hit. Regardless, we know it was quick. He later told SiriusXM that he nailed down the basic verse and chorus structure in "six minutes" — after realizing 1975's Face the Music, the band's in-progress LP, was lacking in catchiness.

"The rest of the album was done," he told Rolling Stone. "I listened to it and thought, 'There's not a good single.' So, I sent the band out to a game of football and made up 'Evil Woman' on the spot. The first three chords came right to me. It was the quickest thing I'd ever done."

Some writers find inspiration within tight confines, using a strange tuning or limiting the scope of an arrangement. For this rockabilly-flavored hit, Mercury gained a spark in his own ignorance, cranking out the tune on an unfamiliar instrument: the guitar.

"Some songs come faster that others," he told Melody Maker in 1981. "'Bohemian Rhapsody,' I had to work at like crazy. I just wanted that kind of song. 'Crazy Little Thing Called Love' took me five or 10 minutes. I did that on the guitar, which I can't play for nuts, and in one way it was quite a good thing because I was restricted, knowing only a few chords. It's a good discipline because I simply had to write within a small framework. I couldn't work through too many chords, and because of that restriction I wrote a good song, I think."

Asia, "Heat of the Moment" (1982)

A crew of veteran prog-rockers went mainstream to craft one of 1982's biggest singles. But just like Black Sabbath before them, Asia's breakthrough only arrived after some prodding from the record company.

Keyboardist Geoff Downes told Prog Magazinein 2019 that "Heat of the Moment" "nearly didn't end up on" the band's self-titled debut. "It was an afterthought," he said. "We were going to lead off with 'Only Time Will Tell,' but the label said, 'Do you have anything else?'"

In response, he and bassist-singer John Wetton put their heads together and hashed out their definitive song, a prog-pop classic with a massive sing-along chorus. "John and I came up with 'Heat Of The Moment' in one morning," Downes said. "Literally, the bones of the song were written in maybe a couple of hours."

U2 closed their triumphant third LP, 1983's War, with an atmospheric track that draws from Psalm 40 of the Christian Old Testament. And as Bono told the crowd during a Nov. 7, 1987 show in Denver, Colorado, the title isn't a reference to the song's last-minute in-studio construction.

“When we were making our third record," he said. "We were being thrown out of the studio by the studio manager because we had overrun or something – and we had one more song to do," he said. "We wrote this song in about 10 minutes; we recorded it in about 10 minutes; we mixed it in about 10 minutes; and we played it, then, for another 10 minutes. And that’s nothing to do with why it’s called '40.'"

This sappy power-ballad is credited only to Jonathan Cain, but the keyboardist claims a spiritual collaborator helped him write Journey's 1983 hit. "It is God-given. God gave me that song," he told Songfacts in 2016. "I don't think I've written a song so quickly. I mean, it was probably a half an hour."

Cain started writing the lyrics on a Journey tour bus heading to Saratoga Springs, N.Y., scribbling down ideas on a napkin. One line stuck out to him the next day: "Highway run into the midnight sun."

"Then, I got this supernatural download: This is the rest of the song," Cain added. "I wrote the rest of it down, almost frantically. I'd never had a song come to me so quickly that it was anointed, supernatural. Literally, in 30 minutes I had written that song. I had the napkin in my pocket and I put it on the piano. I had a big grand piano there, by the orchestra. I played through it and I thought, 'Man, this is good.'"

If only all speeding tickets wound up putting money in your pocket. Sammy Hagar received such good fortune in the early '80s, after a late-night drive inspired his most famous song.

"I was in Africa on vacation with my family on safari for six weeks," the former Van Halen singer told Paul Shaffer. "I came home, two o'clock in the morning, I'm in Albany, N.Y. I flew into Albany and was driving to Lake Placid. I'm going 62 miles an hour, and a cop pulls me over. I'm going, 'What's the deal?' He's going, 'We give tickets for 62 around here.' I'm going, 'Wait a minute, the speed limit's 65.' He goes, 'No, it's 55.' I didn't even know they changed it, and I wrote the song, I swear, right on the spot. This guy's writing the ticket, and I'm writing the lyrics."

Hagar kept driving to his cabin home in Lake Placid, and he finished "I Can't Drive 55" promptly upon arrival. Not only did the the single wind up more than covering his ticket, he also earned an added bonus: “I’ve gotten plenty of tickets in my day, but since that song came out in 1984, most cops let me go," he told Car Talk in 2016. "They say, ‘Oh, it’s you, Sammy, just take a selfie with me and I’ll let you go.’ That’s happened 35 to 40 times.”

Creative constraints also helped spark one of R.E.M.'s essential tracks. Guitarist Peter Buck crafted the jangling main riff from 1991's "Losing My Religion" while watching TV and fiddling around with a mandolin, an instrument he'd recently purchased and was learning to play. He recorded the doodles and, while listening back the next day, realized he had the seeds of an interesting idea.

From there, the Out of Time tune came together in "about five minutes." Singer Michael Stipe even recorded his meditative lead vocal in one take. "I always thought this was the best song on [the album], even before it was a single," Buck told Guitar School in 1993. "I really didn’t expect it to be a hit; I just loved the song and the lyrics."

This folky anthem, anchored to earnest acoustic strumming from Eddie Vedder — who didn't play a note of guitar on the band's debut LP, Ten — was a departure from their signature, boiling hard-rock. Fittingly, its intimate sound originated from an intimate space.

"We were recording the second record [1993's Vs.], and we stayed in this house in San Francisco, and I was outside the house in my own world and the little outhouse had a small room," Vedder told Rolling Stone in 2006. "I'm talking the size of a bathroom. I was able to fit a Shure Vocal Master, which is a '60s PA, and two big towers of PA and a little amp and a [four-track]. I slept in there, too. I remember waking up one morning and playing pretty normal chords that sounded good, and I put on the vocal master to hear myself and it came out right quick. I don't even think I scribbled the lyrics down. It took 20 minutes. [Guitarist Stone Gossard] was sitting outside reading the paper, and he was like, 'I really like that.' So, we recorded it that day."

Guitarist Noel Gallagher claims he wrote Oasis' breakout 1994 single, the thunderous "Supersonic," in the span of an average dinner. The Britpop band were in a Liverpool, England recording studio intending to track the potential single "Bring It On Down." But the mood of the session was flatlining, so Gallagher decided to start from scratch.

"Somebody sent out for Chinese or fish and chips or something, or Chinese fish and chips," he recalled in the 2016 band documentary Supersonic. "I went in the back room and, as bizarre as it sounds, wrote 'Supersonic' in about however long it takes six other guys to eat a Chinese meal."

He emerged with the finished track, and Oasis fell into a simple arrangement that they recorded and mixed that same night. "Do that, change that, right, press record, let's go," guitarist Paul "Bonehead" Arthurs said of their process in the Definitely Maybe documentary. "And we did it. And it was done in a day."

Listening back to that spontaneous magic, Oasis realized they had a monster on their hands. The single came out in April 1994 and became a minor U.K. and U.S. hit — the first step in Oasis' path to rock domination. "We left there that night and listened to it in the car on the way home about 20 times," Gallagher later said of the song. "It was like, 'fucking hell, man. That sounds mega!'"