Baidu (Nasdaq: BIDU) is making nice with the same major labels that have been bellyaching over the search engine's role in propagating music piracy.

China's leading search engine will now be able to legally distribute the digital music of Sony (NYSE: SNE), Warner Music Group (NYSE: WMG), and Universal Music. The landmark deal will find Baidu paying the labels on every stream and download.

Baidu launched a legal music service earlier this year, after joining Sohu.com's (Nasdaq: SOHU) Sogou and other search sites in battling record companies for years. Prerecorded music companies have argued that search engines provide deep links to pirated tracks on third-party websites. In short, the search engines do too good a job of scouring the Web for requested content.

This isn't meant to excuse Baidu and its smaller peers. They have clearly profited from the searches for illegal downloads by serving up ads alongside the organic query results. However, it's not as if China's search engines are evil label busters.

Thankfully, providing legal downloads has become an attractive business, even if stateside streaming champ Pandora (NYSE: P) is richer in registered users than profitability.

Baidu's music site is called ting!, though it can't be confused with Apple's (Nasdaq: AAPL) Ping. Apple's site is simply a social hub built to encourage listener engagement and the actual purchase of downloads. Baidu's ting! is an ad-supported site offering free music. Baidu's effort is a closer match to Spotify, but includes actual downloads alongside the streams.

The best thing about the far-reaching content-licensing deal announced today is that it will help Baidu deflect label criticisms and legal implications. Baidu now has a legal option it can feature prominently, without necessarily inconveniencing its users who are interested in free music.

Baidu has come around, even if it took a few years of singing lessons to hit the right key.

What do you see as the future of music distribution? Share your thoughts in the comments box below.