To add additional detail, music.play() is not a blocking call. It will start playing the music but it won't wait for it to finish playing. Your program will continue on while the music is playing. In this case, as Hapax mentioned, you are then immediately returning from your function, thus destroying your music object and stopping the music from playing. So, it seems like the music is never playing, but what is probably actually happening is that it is starting and then stopping so fast that you never hear it.