Play wav or sound file.

C

Cehotec - Tim

I use perl script for an application which allows users to include
their own code to be ran during the application.

How can I go about creating a sub that you play a wav file. I am not
looking to open the wav with my default player.. but to actually play
the wav. any suggestions would be greatly appricaited. THANKS
 
B

Ben Morrow

Quoth Cehotec - Tim said:
I use perl script for an application which allows users to include
their own code to be ran during the application.

How can I go about creating a sub that you play a wav file. I am not
looking to open the wav with my default player.. but to actually play
the wav.

Basically: how would you play a wav without Perl? Then get Perl to do
the the same way.

You haven't said what OS or desktop system you are using. Most provide
some means of playing a wav from the command-line; under most Unixes you
can use sox(1). Under Win32 I guess you could invoke mplayer2.exe,
though I don't know how you'd go about hiding the window it brings up.

A quick search of CPAN for e.g. 'audio' or 'sound' brings up lots of
potentially useful modules, though again you'd need to say what OS you
were using to know which could help you.

Ben
 
C

Cehotec - Tim

Basically: how would you play a wav without Perl? Then get Perl to do
the the same way.

You haven't said what OS or desktop system you are using. Most provide
some means of playing a wav from the command-line; under most Unixes you
can use sox(1). Under Win32 I guess you could invoke mplayer2.exe,
though I don't know how you'd go about hiding the window it brings up.

A quick search of CPAN for e.g. 'audio' or 'sound' brings up lots of
potentially useful modules, though again you'd need to say what OS you
were using to know which could help you.

Ben

Thanks for the reply. I am using perl on a windows xp system. It's
not necessary a large file that I want to play. I just want to play
something a little more elaborate then a system beep. Say for
instance a user does something wrong, I would like a sound to play.
Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top