PlayWav User's ManualVersion 1.0 November 4, 2001 |
|
µ-Consulting | www.muconsulting.com |
PlayWav is a very simple freeware command-line application that simply plays a Windows .WAV audio file.
Because it is a command-line application, it can be easily integrated into any type of application. It can be run from batch files, various types of scripts, and even NT services such as a web server.
PlayWav is typically used from a custom batch file (.BAT or .CMD) or another application. Because of this, there is no install program for PlayWav. Installation will usually just consist of copying playwav.exe to a directory referenced by the batch file or other application. For convenience, playwav.exe may be copied to the Windows directory (usually C:\WINDOWS or C:\WINNT) or any other directory in the PATH so that it can be executed without the full directory path specified.
The usage is very simple for PlayWav. Just specify the .WAV file name (and directory if necessary) and PlayWav will play the audio file. When the audio file has finished playing, PlayWav will exit. Multiple instances of PlayWav may be executing simulatneously, provided that your audio device supports playing multiple waveform sources.
playwav filename.wav
filename.wav | The name of the .WAV file that you wish to play. If the file is not in the current directory, then the path must also be specified. Enclose the file name in double quotes if it contains spaces. Make sure to include the ".WAV" extension. |
playwav
playwav
playwav c:\sound\alert.wav
playwav "%WINDIR%\Media\chord.wav"
For integration into batch files (.bat or .cmd), the
following error levels are returned by PlayWav:
0 | Error level 0 is returned if the .WAV file has been played successfully. |
1 | Error level 1 is returned if the the .WAV file was not played successfully. |
One popular use of this program is to allow a web server application to play a sound on the web server. For instance, imagine that you are running a web cam on your home computer so that you can watch and listen to your baby, kids, or pets. By setting up a web server (such as Microsoft Personal Web Server or Internet Information Server) on your home computer, you can create a simple web page with hyperlinks that cause pre-defined .WAV audio files to be played on your home computer's speakers. For instance, when you hear your dog start barking, just click the No button on your web site and your dog will hear the correction and (hopefully) stop barking.
Since PlayWav is a command-line application, it can be easily integrated into a web site. Below is a sample CGI Perl script that can be run on any Windows web server that supports Perl. This file is also included in the PlayWav zip file. Please note that due to the complexities of web server configurations, no support is provided for the following Perl script. Of course, bug reports and suggestions are always welcome.
# playwav.pl # CGI Perl script that uses playwav.exe to play a wave file on a web server. # Copyright (c) 2001 by Mu-Consulting (www.muconsulting.com) # This Perl script may be modified freely for your own needs. # The following two variables must changed to reflect your file paths. # This is the directory where wav files are located in. # Make sure to keep the trailing "\\" characters. $mediafileprefix = "c:\\inetpub\\wwwroot\\media\\"; # This is the full path the the playwav.exe file. $playwaveexepath = "c:\\inetpub\\wwwroot\\bin\\playwav.exe"; # Parse HTTP parameters $querystring = $ENV{'QUERY_STRING'}; @pairs = split(/&/, $querystring); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } if (($#argv < 0) & $querystring eq "") { &PrintForm; } $mediafile = $FORM{'f'}; print "Content-type: text/html\n"; print "Cache-Control: no-cache\n\n"; print "<html>\n<head>\n"; print "<title>Play Wav File</title>\n"; print "</head>\n"; print "<body>\n"; if ($mediafile =~ /[^a-zA-z0-9-]/) { print "You entered an invalid media file name.\n"; print "</body>\n"; print "</html>\n"; exit; } print "<font size=+2>\n"; print "Playing media file \"$mediafile\"...<br>\n"; print "</font>\n"; $mediafilepath = "$mediafileprefix$mediafile.wav"; print "<pre>\n"; # Run playwave.exe and output results print `$playwaveexepath \"$mediafilepath\"`; print "</pre>\n"; print "<br><hr>\n"; print "</body>\n"; print "</html>\n"; sub PrintForm { print "Content-type: text/html\n\n"; print "<html>\n<head>\n"; print "<title>Play Wav File</title>\n"; print "</head>\n"; print "<body>\n"; print "You entered an invalid command.\n"; print "</body>\n"; print "</html>\n"; exit; } |
![]() |
Initial release of freeware version. |
PlayWav 1.0 may be freely distributed, provided that the distribution is unmodified and complete with its documentation and playwav.exe
Web Site | www.muconsulting.com |
Technical Support | support@muconsulting.com |
General Information | info@muconsulting.com |