Jay Z has told a jury he had a valid licence to use Arabic music featured on his 1999 hit Big Pimpin' which is the subject of a copyright infringement trial.

The rap superstar spent about 90 minutes giving evidence in a federal courtroom, recounting his life, his successes and the creative process that led him and music producer Timbaland to create Big Pimpin', his first major hit single.

Jay Z and Timbaland are being sued by the heirs of Baligh Hamdi, an Egyptian composer who created the 1957 hit Khosara Khosara that has elements featured in the rapper's hit.

The rapper, whose real name is Shawn Carter, used one of his old CDs - introduced into evidence by a lawyer for Hamdi's family - to illustrate his point.

"We have the rights as you can see on the bottom of the CD," Carter told jurors, referencing liner notes that credit Khosara Khosara.

The rapper mixed his evidence with a mix of no-nonsense, one-word answers, humility about his success and humorous moments.

When Pete Ross, the lawyer for Hamdi's heirs, attempted to show him a passage in a book Carter had written about his lyrics, the performer wryly said: "You can read it from over there."

The courtroom burst into laughter, as it did again when Carter was asked by his own lawyer about artists whose careers he had fostered, including Rihanna, J. Cole and Kanye West.

"Some people may have heard of him," Carter's lawyer Andrew Bart said of West.

"One or two," Carter responded. "He's running for president."

The rapper was more serious when questioned about the rights to Khosara Khosara, which he said he thought had been properly negotiated after issues were raised following the release of Big Pimpin'.

Carter gave mostly curt answers, responding "yes" or "no" or "correct" to many questions.

Lawyers for Carter and Timbaland, whose real name is Timothy Mosley, have told jurors that Hamdi's family had been repeatedly paid for the use of Khosara Khosara. Four of the song's 74 notes are repeated throughout Big Pimpin', a music expert said.

Carter said Mosley introduced the Khosara Khosara melody to him just as he was about to leave a meeting. He said there was nothing like it on the radio at the time, and he put together the bulk of the song over the next few hours.

The rapper said he likes working with Timbaland because they push each other.

"He tells me his beats are better than my raps. I tell him my raps are better than his beats," Carter said. "It's an ongoing thing that I keep winning."

Mosley and many in the courtroom laughed.

Mosley later told the jury that he had the majority of the beat compiled when he added in the flute music from Khosara Khosara. He said he paid 100,000 dollars to settle a claim about the music after Big Pimpin' was released and was relying on representations from his lawyers that he had valid rights.

He provided jurors with a brief demonstration of his creative process, standing at a keyboard and creating a new beat and "beatboxing", which he described as making music with his mouth.

He denied that the Khosara Khosara elements were a major part of what made Big Pimpin' a hit, saying it was his music that was key to its success.

Mr Ross has accused Carter of lacing vulgar lyrics over Hamdi's melody without receiving the proper permission, although Big Pimpin's lyrics are not an issue in the case.

Carter declined to say that the song, which is about leading a promiscuous lifestyle, was vulgar. He said the song featured "adult lyrics" and he still enjoyed performing it.

"I like the song," Carter said. "It's pretty good."