What you are asking is much, much more complicated then you think. Sound from music is made of of tons of frequencies. Just sampling the audio output will give you ‘random’ results because you have no idea where on the waveform the sample is getting taken.
I suggesting googling for what you are trying to do. Here’s a link I found quickly of someone trying to do something like you: http://arduino.cc/forum/index.php/topic,11829.0.html