Apple has splashed out the $3billion (£1.78 billion) to snap up rapper Dr Dre's headphone company Beats Electronics.

The computer giant's swoop is seen as a boost for its attempts to woo younger customers to its iphone and ipods by bringing with it the swagger of Dr Dre and recording impresario Jimmy Iovine.

Beats dominates the headphones market after finally making oversized headphones cool. In the UK, they can be bought in a variety of colours for upwards of £100.

Tonight's announcement comes nearly three weeks after deal negotiations were leaked to the media.

It is the biggest takeover in Apple's 38-year history, a price that the company is paying to counter a threat posed to its iTunes store.

The price consists of 2.6 billion US dollars (£1.5 bn) in cash and 400 million US dollars (£237.6 million) in Apple shares.

With 1.1 billion US dollars (£653.4 million) in revenue last year, Beats will boost Apple's earnings almost immediately.

Apple chief executive Tim Cook said in an interview of Dr Dre and Mr Iovine: "We have known these guys forever,"

"We've dated, we've gone steady and now we are getting married. This relationship started a decade ago, so we know there is an incredible cultural fit.

"These two guys have a very rare set of skills. It's like finding a particular grain of sand on the beach. It's that rare."

Mr Iovine, 61, and Dr Dre, 49, will both become key executives in Apple's music divisions, though Mr Cook said their roles have not yet been determined yet. He said Beats' music streaming service was the main selling point in the deal.

The growing popularity of music streaming services such as Pandora and Spotify has been reducing sales of songs and albums, a business that iTunes has dominated for the past decade.

US sales of downloaded songs slipped 1% last year to 2.8 billion US dollars (£1.7 billion) while streaming music revenue surged 39% to 1.4 billion US dollars (£831.6 million), according to the Recording Industry Association of America.

Although Apple broke into streaming with the launch of iTunes Radio last September, the service has not been as popular or as lucrative as the company expected, according to sources.

Apple is counting on the Beats acquisition to boost its cachet with teenagers and younger adults while trying to remain a leader in digital music - an industry that looks very different from when Apple reshaped the scene with the 2001 debut of the iPod.

"Apple suddenly has regained its cool," said Sony Music chief executive Doug Morris, who was one of the first recording executives to embrace iTunes at Mr Iovine's urging more than a decade ago.

Beats was founded in 2008 by Dr Dre, now a hip-hop producer, and Mr Iovine, a long-time recording industry executive who is currently chairman of Universal Music Group's Interscope Geffen A&M Records.