Pharrell Williams has told a court 'Blurred Lines' was inspired by Miley Cyrus, not Marvin Gaye.

The 41-year-old musician made the revelation in his hour-long testimony for the chart-topping single's trial, in which Marvin Gaye's children Frankie and Nona claim the writer plagiarised their late father's hit 'Got To Give It Up'.

He explained: ''I had Earl Sweatshirt in one room and Miley Cyrus in the other. I was doing a bunch of country-sounding music with Miley.''

''It was like blending this country sound with this up-tempo groove.''

And while he admitted there were a variety of influences involved in the Robin Thicke hit, which he co-penned in mid-2012, the 'Happy' hitmaker insisted the Marvin Gaye single did not enter his mind during the songwriting process.

He continued: ''I must have been channelling that feeling, that late '70s feeling. Sometimes when you look back on your past work, you see echoes of people. But that doesn't mean that's what you were doing.''

''[Marvin Gaye] is one of the ones we look up to so much. This is the last place I want to be right now. The last thing you want to do as a creator is take something of someone else's when you love him.''

The trial regarding the global hit is expected to last for eight days with further testimonies from rapper T.I. and Robin's ex-wife Paula Patton.