DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 21st January 2011
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,165
Default Play soundfile after some minutes using OpenBSD 'aucat(1)'

Code:
#!/bin/sh
# play soundfile after certain amount of time
# using OpenBSD 'aucat(1)' 

SOUNDFILE="/home/j65nko/thesilentforce/track01.wav"

while true ; do
    printf "Time to wait (mm:ss) = "
    read time
    #time='0:10'
    minutes=${time%:*} 
    seconds=${time#*:}
    pause=$((minutes*60+seconds))
    echo "Waiting $time (${pause} seconds) ...."
    sleep ${pause}
    echo =======================
    echo Playing ${SOUNDFILE}
    aucat -i $SOUNDFILE
    echo ======================
done
A sample run, where I terminate the loop with Control-C:
Code:
$ ./alert-me

Time to wait (mm:ss) : 37:00
Waiting 37:00 (2220 seconds) ....
=======================
Playing /home/j65nko/thesilentforce/track01.wav
======================
Time to wait (mm:ss) =  ^C
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New tool to make child's play of DNSSEC signatures J65nko News 1 17th November 2010 10:13 PM
Why I am logged out of this forum every few minutes? Broodjegehaktmetmayo Off-Topic 0 14th December 2009 05:42 PM
Skype-out calls disconnect after about 5 minutes lumiwa FreeBSD Ports and Packages 0 9th June 2009 12:56 PM
Play mediastream PatrickBaer FreeBSD General 12 27th September 2008 09:54 AM
How to play an avi video? aleunix OpenBSD Packages and Ports 3 16th June 2008 06:25 AM


All times are GMT. The time now is 11:04 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick