Massyn has asked for the wisdom of the Perl Monks concerning the following question:
#!/fellow/monks.pl
use Win32::Sound; Win32::Sound::Play("tada.wav"); Win32::Sound::Stop;
... works fine when I'm playing a WAV, but what about MP3? The same code unfortunatly does not cut it. Any ideas how I can use the internal Windows methods to play MP3s?
Thanks!
#!/massyn.pl
Don't -- me without telling me why. If you asked a stupid question, I wouldn't down vote you.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Playing MP3 file?
by Corion (Patriarch) on Oct 01, 2003 at 10:30 UTC | |
Windows has no "internal method" to play mp3s. At best, you can have a codec that decodes .wav files encoded with the Layer-III codec (for example by the Fraunhofer Institut). Your best bet short of manually decoding the mp3 stream or linking a mp3 player DLL is to launch the mp3 file through the shell facilities:
| [reply] [d/l] [select] |
Re: Playing MP3 file?
by benn (Vicar) on Oct 01, 2003 at 12:16 UTC | |
Included in the Audio::MPEG docs is an MP3->WAV routine which may come in handy. Cheers, Ben. | [reply] |
by Arbogast (Monk) on Oct 01, 2003 at 14:50 UTC | |
a> I don't have the code handy, but you can launch Windows Media Player with a playlist as a Win32 process. I never learned how to make a WMP playlist from Perl, :(. b> The way I do it now in my Perl programs is to embed the MP3 in a SWF file in a local html file and play it through the Internet Explorer. (Then you can make a pretty album cover to display while the music plays.) Just launch the Internet Explorer with html file as argument with win32 process. | [reply] |
Re: Playing MP3 file?
by teabag (Pilgrim) on Oct 01, 2003 at 15:05 UTC | |
I was working on exactly the same problem while reading this node ;). Audio::Mpeg does however needs an external library, if I understand the docs correctly? I'd kiss him if only he were a pretty girl. ;) below my code, you might find it handy, allthough it could use some cleaning up. Messy teabag eh...
Teabag Sure there's more than one way, but one just needs one anyway - Teabag | [reply] [d/l] [select] |
Re: Playing MP3 file?
by elwarren (Priest) on Oct 01, 2003 at 15:49 UTC | |
You might be able to convince Win32::MCI::Basic to play your file. HTH! | [reply] |
Re: Playing MP3 file?
by newrisedesigns (Curate) on Oct 01, 2003 at 16:16 UTC | |
Arbogast mentioned playing the file through Flash. Seven Deadly (Lore Sjoberg of the Brunching Shuttlecocks) has produced Echindna, which does this using Perl and some predesigned flash. Hope this helps. John J Reiser | [reply] |