Discussion:
use of at to schedule a sound
(too old to reply)
Joseph Rosevear
2023-02-18 02:17:36 UTC
Permalink
Hello,

I'm trying to schedule, using at, the playing of a sound. I can schedule
events OK, but the playing of a sound is troublesome. Pulseaudio doesn't
want to cooperate.

I'm using

play -q /usr/share/sounds/purple/alert.wav

in a script to play the sound.

I schedule the execution of the script with
another script that performs

at -f $level/ring now + $1 minutes

$level is the location of the script that plays the sound, and ring is
the script.

It doesn't work. Pulseaudio seems to hang. Sometimes it plays the sound
later--maybe after a shut down and restart? I didn't carefully note the
scenario.

I'm running the script as an ordinary user in an environment that has
pulseaudio already running.

-Joe
Henrik Carlqvist
2023-02-18 10:34:56 UTC
Permalink
Post by Joseph Rosevear
It doesn't work. Pulseaudio seems to hang. Sometimes it plays the
sound later--maybe after a shut down and restart? I didn't carefully
note the scenario.
My guess is that when called from at, your script will call play which
will not, as you assume, use pulsaudio. Instead I guess that play uses
some other, older audio device like /dev/audio which is blocked by some
other application (pulseaudio?). When that other application releases the
device play will get to play its sound.

On the manpage of play is a description of the environment variable
AUDIODEV that can be used to tell play which audio device to use.

regards Henrik
Joseph Rosevear
2023-02-19 08:30:40 UTC
Permalink
Post by Henrik Carlqvist
Post by Joseph Rosevear
It doesn't work. Pulseaudio seems to hang. Sometimes it plays the
sound later--maybe after a shut down and restart? I didn't carefully
note the scenario.
My guess is that when called from at, your script will call play which
will not, as you assume, use pulsaudio. Instead I guess that play uses
some other, older audio device like /dev/audio which is blocked by some
other application (pulseaudio?). When that other application releases
the device play will get to play its sound.
On the manpage of play is a description of the environment variable
AUDIODEV that can be used to tell play which audio device to use.
regards Henrik
Henrik,

Thank you for your reply. You gave me some things to think about.

By the way I ran some more tests, and it seems there is something wrong
with my installation. I tested scheduling a simple event without sound,
and that showed the same trouble.

Then I did the same simple test on a different Slackware installation,
and it worked with no trouble, although I didn't go so far as to test the
sound.

It seems my system is due for some upgrading--to try to chase the bugs
out.

-Joe

Loading...