will.i.am wrote 'I Gotta Feeling' in his sleep.

The Black Eyed Peas star claims the 2009 track - which is the most downloaded song of all time and has sold around 13 million units worldwide - was one of many that stems from a vision he had in a dream and woke up to work on right away.

He told BBC Newsbeat: "I've written songs right from a sleep. Have you ever had a dream where there's a melody in your dream? I'll wake up out of my sleep and record that!

"'I Gotta Feeling' was one of those songs. From a random mumble, listening to conversations in the back and making sense of melodies."

will.i.am isn't the only artist to claim inspiration comes to him in dreams.

Florence Welch recently revealed her track 'Only if for a Night' was inspired by a nocturnal vision she had of her late grandmother while on tour in Germany, although the singer was surprised by what happened in the dream.

Florence said: "She told me, 'Concentrate on your perfect career'. Can you imagine? It's like, 'You've left your laundry out and it's going to rain'. 'OK Grandma, thanks!' I thought it would be something, y'know, more cryptic."