On the mac there is a feature which allows you to get your computer to verbally announce the time on the hour, is there something similar on Ubuntu? That is is there a package which already does this or do I need to configure something like say
to read out the time on the hour? And if so then how do I do that? I am running Ubuntu GNOME 15.04 with GNOME 3.16.
2 Answers
You could use your crontab
Create a little script
mkdir -p ~/bin nano ~/bin/say_hour
add the code below
#!/usr/bin/env bash
my_date=$(date +'%H:%M:%S')
padsp espeak "$my_date"
and set executable rights
chmod +x ~/bin/say_hour
Edit your crontab via
crontab -e
and add the configuration below
0 * * * * bin/say_hour
You can replace the espeak
line with one of the possibilities below
sudo apt-get install espeak
espeak $(date +"%H:%M:%S")
espeak $(date +%T)
# Adjust speed with `-s`, in words per minute, default is 160
espeak -s 10 $(date +"%H:%M:%S")
or
sudo apt-get install festival
date +"%H:%M:%S" | festival --tts
date +%T | festival --tts
or
sudo apt-get install speech-dispatcher
spd-say $(date +"%H:%M:%S")
spd-say $(date +%T)
# Adjust speed with (-100 .. 0 .. 100)
spd-say -r -50 $(date +%T)
%I
– hour (01..12) format%H
– hour in (00..23) format%M
– minute (00..59)%S
– second (00..60)%P
– period (AM/PM)%T
–HH:MM:SS
in 24 Format
More options via man date
, man espeak
, man festival
and man spd-say
-
That doesn't work, it just wants input and gives me one of these
>
.– user364819Commented Oct 18, 2015 at 11:12 -
-
1
-
Could you also please include in your answer how to get it to run on the hour, perhaps with a cron job as I know about them and how they work, but have never actually set one up manually.– user364819Commented Oct 18, 2015 at 11:22
-
In fact, I have a Raspberry Pi under my desk which does exactly this (and much more). It runs not the full Festival but Festival Light (
flite
). It speaks the time at the full hour, and (hh:mm) whenever I send it a Wake-on-Lan packet. I set it to speak slightly slower (set Duration_stretch=1.3
) to get a more pleasant tone of voice.– JosCommented Oct 18, 2015 at 14:23
This gives you the time in speech (thanks to kos for providing better syntax) :
First install say
, which is found in gnustep-gui-runtime
:
sudo apt-get install gnustep-gui-runtime
Then run it.
24-hour mode:
say "$(date +%R)"
12-hour mode
say "$(date +%I:%M%p)"
-
Could you also please include in your answer how to get it to run on the hour, perhaps with a cron job as I know about them and how they work, but have never actually set one up manually.– user364819Commented Oct 18, 2015 at 11:13
-
Sorry, I don't know how to do that @ParanoidPanda . If someone else does, they can post it as a comment and I'll include it in my post– PromilleCommented Oct 18, 2015 at 11:21
-
@ParanoidPanda askubuntu.com/questions/2368/how-do-i-set-up-a-cron-job ;)– kosCommented Oct 18, 2015 at 11:23
-
@Wildcard: A.B. has included it in his answer so you could probably just take it from there or read what kos commented. :)– user364819Commented Oct 18, 2015 at 11:34
-
@ParanoidPanda A.B. has the accepted answer, so it's not really that important– PromilleCommented Oct 18, 2015 at 11:38
date
outputs it in text. maybe you could pipe that through a text-to-speech program?[time]
replaced with the hour):It is now [time] O'clock
sed