sierrathedog04 has asked for the wisdom of the Perl Monks concerning the following question:

CPAN does not seem to have any modules for playing CDs on Windows ME machines.
  1. Audio::Play can only play .au or .snd files
  2. AudioCD only supports MacPerl
  3. Audio::CD requires the use of a third-party library and provides a dead link to where the library is available.
  4. Win32::Sound only plays WAV files.

I am seeking a Perl module which can provide me with low level access to the audio tracks on a networked CD drive. I need such a module because the native Windows Media player will not play the .cda audio tracks on the networked CD. It sees them there, lists them, but gives a non-descript error when I attempt to play them.

It seems to me that the Perlish way to solve this problem would be to find a Perl module for playing audio CD tracks, dig deeply into the code, see where the module is failing, and fix the problem.

But I cannot attack the problem in a Perlish way, because there is no Perl CD Player module to get me started. Does anybody know of one?

Replies are listed 'Best First'.
(crazyinsomniac) Re: Perl CD Player?
by crazyinsomniac (Prior) on Mar 05, 2001 at 15:24 UTC
    Here's what i can tell you:
    CDPlayers by default, no matter what the platform is, use the cd-rom's(the hardware) CDPlaying abilities. Your cd-rom is hookedup to your sound card, and can play any sound cd just like a cd/casette stereo or boombox or something would.

    So that is why Windows Media Player won't play a networked CD on your system because it's playing it on the networked drives system(you can't hear).

    In order for you to hear it, it'd have to read the raw track, just like most 'cd rippers' do, and then send that data over the network.

    That's a lottof bytes to be rippin' and sendin' on the fly.

    I doubt you'll find a workable solution, much less a pure perl one(I looked it's all 'bout 3rd party libs sorry;(*wah*).

     
    ___crazyinsomniac_______________________________________
    Disclaimer: Don't blame. It came from inside the void

    perl -e "$q=$_;map({chr unpack qq;H*;,$_}split(q;;,q*H*));print;$q/$q;"

Re: Perl CD Player?
by $code or die (Deacon) on Mar 05, 2001 at 18:38 UTC
Re: Perl CD Player?
by t0mas (Priest) on Mar 06, 2001 at 16:36 UTC
    I think crazyinsomniac is right about a networked CD player, but if you want to play local CDs, here's something to get you started (if you can stand OLE :)
    #!/usr/bin/perl -w # Modules use strict; use Win32::OLE; use Win32::OLE::Variant; # Variables use vars qw($Player $stop); # Initialize OLE Win32::OLE->Initialize(Win32::OLE::COINIT_MULTITHREADED); # Create a new OLE object $Player = Win32::OLE->new('MCI.MMControl.1') or die Win32::OLE->LastError(); # Set stuff $Player->{Notify} = Variant(VT_BOOL, 0); #off $Player->{Wait} = Variant(VT_BOOL, 1); #on $Player->{Shareable} = Variant(VT_BOOL, 0); #off $Player->{DeviceType} = "CDAudio"; # Open device $Player->{Command} = "Open"; # Skip first 3 songs print "Skipping songs...\n"; foreach (1..3) { $Player->{Command} = "Next"; } # Plays from 4th song... $Player->{Command} = "Play"; # ...until user presses enter print "Press enter to stop playback...\n"; $stop=<STDIN>; # Stop $Player->{Command} = "Stop"; # Close device $Player->{Command} = "Close"; print "Done.\n";


    /brother t0mas