What you are trying to implement here follows the typical
producer-consumer pattern[
^].
The producer will be the downloader of the music file and the consumer will be the player.
Do some research on that and you'll most probably even find some sample code.
Regards,
— Manfred