Music streaming platforms are finally making money for the music industry in the United States. This marks the first time in decades that the music business is seeing an upward climb, after suffering losses courtesy of content piracy and declining sales of CDs and other physical media.

Bloomberg Technology reports that the U.S. music industry grew for the second consecutive year, with retail spending on music up 8.1 percent in the first half of the 2016 calendar year. According to the Recording Industry Association of America’s (RIAA) midyear report, consumers have spent $3.4 billion on recorded music thus far this year.

“Over the first half of 2016, there were an average of more than 18 million music subscriptions, doubling the 9 million reported at the same time last year,” wrote RIAA Chairman Cary Sherman said in a blog post. “Music subscriptions are now significantly bigger revenue generators than CD sales, and virtually equal to permanent downloads.”

The 2015-2016 spike is the first time the industry has seen growth, says Bloomberg, since 1998-1999 when CD sales were at a record high and right before the first popular peer-to-peer file trading service launched. This time around, the source of high sales are streaming services, like Spotify Ltd. and Apple Music, that give listeners access to an abundance of music at no cost in lieu of listening to ads or for a monthly fee.

“It feels like the market is slowly recovering after years of being in crisis and shrinking,” Zach Katz, the head of U.S. operations at BMG Rights Management GmbH, a record label and music publisher, told Bloomberg Technology. “It’s absolutely a step in the right direction.”

In fact, the RIAA report  revealed that ad-supported on-demand streaming increased by 24 percent to $195 million in the first half of the 2016 calendar year. But according to Sherman, the threat still remains for the industry.

“Despite the massive consumer demand for music, the damning reality remains that music is fundamentally undervalued, with broken, outdated laws threatening the entire music community and distorting the marketplace,” wrote Sherman. “The result? Many services rake in billions of dollars for themselves on the backs of music’s popularity but pay only relative pennies for artists and labels. Pirate sites operate with seeming impunity.”

While the industry, as a whole, has seen an increase, the broader profitable trend is not the case for every company. Rapper Jay Z’s streaming service Tidal, which has over 4.2 million paying subscribers, recorded a $28 million net loss in 2015 and $10.4 million in 2014, according to a legal filing, while increasing revenue by 30 percent. The platform’s competitor, Spotify, also had a net loss in 2015 but, unlike Tidal, it doubled its revenue.