I'm trying to write some code in perl (specifically) to output sound (specifically, MP3s) to my sound card. I've not seen any examples of outputting any sound to the soundcard in perl, so examples of that would be helpful.
My question is, how d开发者_如何学运维o audio players output sound to the sound card? Do they convert them to WAV on the fly?
SDL::Sound solves this problem for WAV files. There are several packages for converting compressed MP3 files to WAV, such as Audio::MPEG and Audio::ConvTools.
Are you on Linux? If so you can do your logic in Perl and then shell out to some command line player, like mpg123
. Not a pure Perl solution, but gets the job done.
精彩评论