Apple has announced that it has agreed to acquire the subscription streaming music service Beats Music, and Beats Electronics, which makes the Beats headphones, speakers and audio software.