Apple will buy leading song recognition app Shazam, the companies said last night, in a fresh bid by the tech giant to gain an edge in online music.

"Apple Music and Shazam are a natural fit, sharing a passion for music discovery and delivering great music experiences to our users," Apple said.

The company did not disclose financial terms of the deal. 

Since it was founded in 1999, Shazam has offered a high-tech solution to listeners' agony over not recognising music on the radio or in shops and bars, letting users identify songs through their phones' microphones.

Shazam, which is based in London, said last year that it had reached one billion downloads on smartphones. 

But it only recently started to see profitability by incorporating advertisements and tying up with other tech firms, including Spotify and Apple, to which it refers traffic. 

It would remain to be seen how Apple would integrate Shazam, which also faces competitors such as SoundHound.

Apple, which earlier revolutionised online music with iTunes, in 2015 launched Apple Music as the market turns to streaming, which offers unlimited on-demand listening. 

Apple said in September that the service had more than 30 million subscribers - a rapid rise but still trailing industry leader Spotify which said it had 60 million paying users as of July and 80 million more on its free tier.

Stockholm-based Spotify last week said it and China's Tencent were taking minority stakes in each other - a likely sign of Spotify's growth ambitions in the world's most populous country, where it is not yet present.