Page 1 of 1

How to use Pschedule to play continuous sound?

Posted: Fri Jan 07, 2022 6:25 pm
by uj49

Hi everybody.
I need to get “Pschedule” to advertise a task every 90 min. Apart from the visual note I would also like for “Pschedule” to play a continuous sound, that will only stop when the visual note is closed.
Does anyone know how to achieve this ?
Thank you very much for your help.
uj


Re: Pschedule to play continuous sound

Posted: Fri Jan 07, 2022 7:28 pm
by don570

gtkdialog scripts that we use in puppy can stop commands I believe, (using kill command)
but I'm not sure if pschedule can launch gtkdialog scripts since I only have used it for simple one line commands.

a continuous sound

Code: Select all

#!/bin/bash
while [ 1 ] ; do
 aplay file.mp3
done

or a line

Code: Select all

while [ 1 ] ; do aplay file.wav ; done

Re: How to use Pschedule to play continuous sound?

Posted: Sat Jan 08, 2022 3:43 am
by williams2

Code: Select all

#!/bin/sh
sound=/root/471-Chopin_Valse_Op69.mp3
while true
do
sleep 90m
mpv --loop --really-quiet --force-window=no $sound &
pid=$!
yaf-splash -close never -fontsize 26 -bg cyan4 -text 'Important Announcement' &>/dev/null
kill $pid
sleep 2
kill -9 $pid 2>/dev/null
done

Or you could use cron.


Re: How to use Pschedule to play continuous sound?

Posted: Sat Jan 08, 2022 9:02 am
by uj49

To Don570
Thank you for your information. I will try it out and see what happens.

To williams2
Thank you also for your info.
I am a newbee and understand that this script might just do what I need. However, where must I place this script to get “Pschedule” to find it ?


Re: How to use Pschedule to play continuous sound?

Posted: Sat Jan 08, 2022 7:55 pm
by don570

pschedule is a frontend for cron daemon
You should learn cron first .

Basic rule -->
edit file /var/spool/cron/crontabs/root with crontab command


Re: How to use Pschedule to play continuous sound?

Posted: Sat Jan 08, 2022 9:55 pm
by williams2

where must I place this script to get “Pschedule” to find it ?

The script does not use cron at all (Pschedule configures cron)

You need to edit the script to change the path and name of the sound file that you want to use.
And change the text of the message.

You could put the script in /root/Startup/ to make it run automatically every time Puppy boots.

Basically, all the script does is sleep for 90 minutes,
then plays a sound file continuously in the background,
then pops up a message,
and when the message window is closed, the sound file stops playing.

or you can use cron, probably configuring it to execute a script every 90 minutes.


Re: How to use Pschedule to play continuous sound?

Posted: Tue Jan 11, 2022 8:31 pm
by don570

Here is a script that works with aplay rather than mpv
I need to check if pschedule can launch it . I've just tested it with the terminal.

Code: Select all

#!/bin/sh
# continuous sound is heard until  window is closed


echo '
#!/bin/sh
while [ 1 ] ; do  aplay /usr/share/audio/2barks.au ; done  2>/dev/null
'  >/usr/sbin/continous_script.sh

#permissions must be given to /usr/sbin/continous_script.sh
chmod 755 /usr/sbin/continous_script.sh
/usr/sbin/continous_script.sh &
pid=$!

#  when gtkdialog window is closed  --  kill is executed
export QUIT='<window   title="Continuous Sound"  icon-name="ptiming">
 <vbox>
   <hbox homogeneous="true"><text><label>"'$(date)'"</label></text></hbox>
   <hbox homogeneous="true"><text><label>"Exit to kill sound"</label></text></hbox>
   <hbox>        
       
	  <button>
      <label>"Exit"</label>
      <action type="exit">CLOSE</action>
      </button>	   
   </hbox>
  </vbox>
 </window>
'
 gtkdialog -p QUIT -c     

kill -9  $pid 2>/dev/null

______________________________


Re: How to use Pschedule to play continuous sound?

Posted: Wed Jan 12, 2022 6:30 pm
by uj49

Hi Don570
Thank you so much for your efforts.
I will try out your script on the weekend.
When I tried willams2 script I found that the message appeared but I could not get a sound to play. Also I was not able to close the message.
So I am looking forward to see whether I can get on with your script.
Have a nice day
uj


Re: How to use Pschedule to play continuous sound?

Posted: Wed Jan 12, 2022 7:05 pm
by don570

I described how to use script in fatdog64 here -->
http://forum.puppylinux.com/viewtopic.php?t=4937

_____________________________________________

When I tried willams2 script I found that the message appeared but I could not get a sound to play. Also I was not able to close the message.
So I am looking forward to see whether I can get on with your script.

willams2 script requires mpv to be installed and yaf-splash is not a good method to make alarms or warning messages
because there are various none-compatible versions distributed in puppy linux.

_____________________________________