What happens when you try to play a music file with a command line player, ie mpg321? Do you get an error?
If you get an error message, you can write a perl script using `backticks`. Backticks are the key that doubles as the ~tilde. Try putting a command in backticks and printing the result.
print "The result of the command is "
my $i = `ls`
If you can get an error msg out of a command line player, you can parse the output.