Eli Fulkerson .com
HomeProjectsCommandline-wav-player
 
 


sounder.exe - play a wav file from the command line

Description:

Sounder.exe plays .wav files from the command line. It was written to provide audible alerts to windows batch files.

Usage: sounder [/stop] [/loop times] [/timer ms] [/help]  filename.wav

Options:
    /stop           Creates the file "stopfile" in the current directory, which will stop preexisting playback
    /loop times     Plays the wav file "times" times before exiting
    /timer ms       Stops after "ms" milliseconds, even if the sound isn't done
    /help           Shows this help screen.
    /id             Specify a custom stopfile id to stop this sound individually
    /stopbyid       Creates the stopfile specified by /id, which will stop all prexisting matching sounds
    /unique         Will not start playing a sound if another /unique sound with the same /id is already playing.

Options are provided in both the windows and unix styles.  The flags "-s", "/s", "/stop", "-l", "/l", "/loop", "-t", "/t", 
"/timer", "-h", "/?", "/help", "/h", "-v", "/v", "/version" all work but are omitted above for brevity.

In order to use the "stopfile" functionality, the working directory must be writable. 

Examples

Its getting a little complicated, so for instance if you have two alarms, one alerting you to ducks and the other alerting you to bears, but want no more than one copy of each .wav playing simultaneously...

sounder.exe /id bears /stopbyid bears.wav
sounder.exe /id ducks /stopbyid ducks.wav

Those commands can be spammed - at any given time they will stop the playback of the specific wave file and start another, but won't interfere with the other wave file.

To make all the sound stop, regardless of /id, you can issue a "sounder.exe /stop". To make all sound stop and play a new .wav file issue a "sounder.exe /stop newfile.wav". (stops existing playback, then plays newfile.wav)

Download:

sounder.exe

Old Versions:

This is the old "play the whole file, then exit" version:

sounder.exe, win32 console application
source code

This is the old "play first two seconds asynchronously" version:

sounder.exe, win32 console application
sounder.exe, win32 console application, zipped
source code

This is the old "play until the file 'stopfile' is created" version:

sounder2.exe, win32 console application
sounder2 source code