[plug] Sound Alerts

Matt Kemner zombie at wasp.net.au
Tue Sep 5 09:33:03 WST 2000


On Mon, 4 Sep 2000, Subba Rao wrote:

> One of our key systems has been configured to create a sound for an alert
> on the system. We have setup several alerts on this system. The sound driver
> used on this system is from OSS. Now, what happens when multiple alerts are
> set off at the same time? Do the alerts get queued to the driver?

Either have a look at the Enlightened Sound Daemon[1], which will mix
together several sounds (so they can all play at once) or write a wrapper
script which locks /dev/dsp somehow[2], and pauses if it detects a wait -
so it will queue the sounds for you.

[1] sound/esound_*.deb for Debian,

[2] easiest and safest way to do this from a shell script is to create
    a directory in a non-public space (ie NOT in /tmp) eg something like:
    (untested, but should be close to working code, if not already)

    #!/bin/bash
    count=0
    while ! `mkdir /root/dsplock >&/dev/null`
    do
      sleep 10
      count=$(($count+1))
      if [ $count -eq 6 ]
      then
        echo DSP has been locked for over a minute, killing.
        killall wavplay
        rmdir /root/dsplock
      fi
    done
    wavplay alert.wav
    rmdir /root/dsplock


 - Matt




More information about the plug mailing list