There are several perl modules that allow you to edit mp3's (such as the id3 tags), but I don't believe any that let you play them.
I know there is a perl module that allows for you to play WAV files. Don't quote me on this, but I believe the author was updating the module to play mp3's as well.
You can go to
to download a module called Win32::Sound. Obviously, this only works on Win32 machines, so if your server is not one, then you are out of luck or will have to find an alternative.
Here is some code that will get you on your way:
[tt]
use Win32::Sound;
# Create the object
$WAV = new Win32::Sound::WaveOut(44100, 8, 2);
$data = "";
$counter = 0;
$increment = 440/44100;
# Generate 44100 samples ( = 1 second)
for $i (1..44100) {
# Calculate the pitch
# (range 0..255 for 8 bits)
$v = sin($counter/2*3.14) * 128 + 128;
# "pack" it twice for left and right
$data .= pack("cc", $v, $v);
$counter += $increment;
}
$WAV->Load($data); # get it
$WAV->Write(); # hear it
1 until $WAV->Status(); # wait for completion
$WAV->Save("sinus.wav"

; # write to disk
$WAV->Unload(); # drop it
[/tt]
Hope this helps.
-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====