Singer Paul McCartney speaks to the media in Washington about the Library of Congress Gershwin Prize for Popular Song on Tuesday. ((Jacquelyn Martin/Associated Press))

Paul McCartney is to make a White House appearance on Wednesday to receive the Gershwin Prize for Popular Song honouring a lifetime of songwriting.

The former Beatle is also set to perform for President Barack Obama in the evening in Washington, D.C., a prospect the musician admitted makes him "slightly nervous.

"For an English kid growing up in Liverpool, the White House — that's pretty special," McCartney said.

He was feted at the Library of Congress on Tuesday night, in front of celebrity guests such as Stevie Wonder, Elvis Costello, Jack White, Herbie Hancock, Dave Grohl, Emmylou Harris and Faith Hill.

'I have to believe in the magic.' —Paul McCartney, musician

He also fielded questions about his songwriting and environmental issues, including the oil leak in the Gulf of Mexico, from the Washington Press corps.

The Library of Congress songwriting honour, first awarded in 2007, is named for the team of George and Ira Gershwin, creators of songs such as Summertime and They Can't Take That Away from Me.

The prize, which "recognizes musicians whose careers reflect a lifetime achievement in promoting song as a vehicle of artistic expression and cultural understanding," has been won by Wonder and Paul Simon.

At the news conference Tuesday, McCartney said the award was special because he had listened to Gershwin music when he was growing up.

McCartney talked about his songwriting process, saying the tune for Yesterday came to him a dream.

 "Some of the songs you write, you don't know where they come from," he said. "So I have to believe in the magic."

Concert planned

He performed the song with the Loma Mar Quartet, which played string instruments from the library's Stradivari collection dating back to the late 1600s. After he was pressed for an encore, he returned to the stage to perform Blackbird.

Pianist Lang Lang also performed on George Gershwin's piano.

McCartney will receive the Gershwin award at the East Room in the White House.

Although he has a Grammy for Lifetime Achievement, this is McCartney's first major lifetime achievement award from the U.S. government. He also has been knighted.

A concert is planned to celebrate his music, with performances by the Jonas Brothers, Jack White, Costello and Wonder, and an appearance by Jerry Seinfeld.

The concert will be televised July 28 on PBS.

With files from The Associated Press