Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Playing wav files

by merrymonk (Hermit)
on Feb 08, 2019 at 15:26 UTC ( [id://1229622]=note: print w/replies, xml ) Need Help??


in reply to Re: Playing wav files
in thread Playing wav files

Thank you. Something very similar works on my PC for system sounds. This is shown in the Perl below. I get all the same sound except for SystemHand. ..it is other wav files, which I know give different sounds (I can hear these in another application) which seem to be the problem.
my (@wsn, $js, @wavf); $wsn[0] = 'SystemDefault'; $wsn[1] = 'SystemAsterisk'; $wsn[2] = 'SystemExclamation'; $wsn[3] = 'SystemExit'; $wsn[4] = 'SystemHand'; $wsn[5] = 'SystemQuestion'; $wsn[6] = 'SystemStart'; for($js = 0; $js <= 6; $js++) { print "before play $wsn[$js]\n"; Win32::Sound::Play($wsn[$js]); print "after play\n"; }

Replies are listed 'Best First'.
Re^3: Playing wav files
by pryrt (Abbot) on Feb 08, 2019 at 15:36 UTC

    That seems more like a reply to mine rather than the one it actually replied to. if you agree, I will consider it for reparenting. If you really meant it where you put it, sorry for the misunderstanding.

    The goal of my listing of the various System sounds was to ensure that your soundcard and Win32::Sound installation were correct. Which seems to be the case based on this code.

    My other examples -- running sinus.pl, or directly accessing the welcome.wav, while in the Win32::Sound samples/ directory -- was an attempt to make sure that you're really in the directory you think you are, and to make sure you can really get to a local wav file. If you don't want to download the whole tarball, you could run the code from the EXAMPLE portion of Win32::Sound, which will create sinus.wav in your local directory; you can then run perl -MWin32::Sound -e "Win32::Sound::Play('sinus.wav', SND_NODEFAULT)" and it should play, then perl -MWin32::Sound -e "Win32::Sound::Play('sinus.wavx', SND_NODEFAULT)" and it should do no sound at all, because 'sinus.wavx' doesn't exist.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1229622]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found