As an example...
I was working on a Perl/Tk chat client for a chat server that uses a proprietary protocol. After it got several version numbers mature, I wanted to add some simple sound effects to it, such as playing a sound that was appropriate for the chat server when users entered or exited the room.
On Windows I could've used Win32::Sound or Win32::MediaPlayer - I ended up using the latter. But this program has historically been very cross-platform and if I were to add sound effects to the Windows client, I needed to also have sound effects for other operating systems.
I ended up just using the `play` command (from SOX on Linux) as a default for Linux, and `afplay` as a default for Mac OS X. On Win32 it would automatically use Win32::MediaPlayer, but on all other platforms a command-line program was configurable (if the user wanted to use `mplayer` instead of `play`, they could customize that).
Now I know about GStreamer for Linux, but there's still no relatively easy module for OS X for playing sound. So this is just one example of why a command-line audio player is useful.
The downside to `play/afplay` is that you can't control it once you start it, so it's only suitable for short sound effects. So, a command-line media player that can be commanded and controlled once it begins would be good for similar situations as this, except when longer music clips are desired and not just short sound effects.
|