Talking Clock

A home for all kinds of Puppy related projects
Message
Author
User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Talking Clock

#1 Post by Geoffrey »

NEW VERSION 1.3.1

Latest SneekyLinux as kindly donated his voice for the clock, it was recorded at 44100 Hz 16bit so I have converted it to two sizes,
44000Hz 8bit and 8000 Hz 8bit to keep the file size to an acceptable amount.
I can barely tell the difference in the two files, then my HiFi is telephone quality these day's.

Well I have updated to version 1.3.1, this has a tidier looking GUI with hotkey's for all the function's, there is no wav files included with the package,
a voice package can be downloaded separately, I will say that this runs fine on my PC using Lucid 5.2.8, it should run on any puppy as it only relies on clock data and aplay,
if you already are using any of the other versions that being 1.1 or 1.2 then they will need to be completely removed to use this as the file structure is configured differently.

If for any reason the cron job gets removed, you will have to create a new one using "say_clock_time" as the command to be executed.
The next version I may add a button to add a new cron job, I also need to create some more voice's,
it's easy enough to do just need to emulate the wav file's stored in /root/.talking_clock/data/ and name them accordingly.
Anyway let me know if you find a problem, I'm sure it should be fine though.

Image


I'll leave the version 1.1.
==============================================================================================================================================


I've been looking for talking clock and came across a few bash scripts that will do the job, also found some wav files that
I have edited and re-sampled into 8bit files, it doesn't sound to bad though the script could do with some work, as on the hour is say's the 0:0
I would prefer it to say just the hour with either AM or PM, I'll have to do some reading on script writing, anyway it may be of interest to some.
maybe some would like to make a puppy app with it, it is small less than 200k extracted.

Geoffrey

Edit:

I've put together a package for the taking clock using wav files, it is 204k installed, during the install it amends to /var/spool/cron/crontabs/root, so that it runs on the hour,
a small GUI is installed also, this can be found in the menu under system, look for " Say Time Config ", from this small GUI you can set different sound effects and preview them,
also selecting " Setup " will open Pschedule to allow the changing of the clock event timing, this is basic scripting nothing fancy, tried to keep it as simple as possible.

It will speak the time in the AM/PM format, at 12AM it will say " TWELVE MIDNIGHT " and at 12PM say " TWELVE NOON ", depending on the speed of the computer the effects may not work
as they should as they rely on running multiple instances of aplay to get the echo effect, I have not tried this on another PC, works fine on mine but saying that it is a
AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ Core 0: 2310 1: 2310 MHz with 3gigs of ram.

Should it be uninstalled, manually delete the Pschedule entry from within Pschedule as if it is installed again it will amend another copy to /var/spool/cron/crontabs/root.

I think I've covered everything that's needed to be known, let me know how it runs, I'm not planing on doing anymore to it, it seems to work well enough as it is, well it
suit's my purposes, maybe someone would like to make some voice packs.

Edit: I tried this with Slacko 53, had a problem it locked up the PC resulting in a Ctrl+Alt+Back and xwin to get going again,
this happened when the config was run from the menu, I edited the config script so now it works.
Attachments
sneekylinux_8k8bit_en-1.pet
(126.81 KiB) Downloaded 658 times
say_time-1.3.1.pet
(9.61 KiB) Downloaded 691 times
say_time_slow_male_en-1.pet
Voice pack for say time 1.3.1 only
(139.35 KiB) Downloaded 687 times
saytime-1.1.pet
Updated so that it works from Slacko53 system menu, previous version locked up Puppy
(75.73 KiB) Downloaded 700 times
Last edited by Geoffrey on Sun 20 Nov 2011, 03:01, edited 6 times in total.

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#2 Post by Lobster »

:)
I was hoping to able to talk to time itself :shock:
Thanks for providing this, works well - sound not brill but theory is valid.

I am trying to think of an application - you know something like your backup will be ready at 'saytime' . . .

I know there will be a need for this when I build my time travel prototype . . . just got to wait for Cern to provide blue prints . . . and an inter-dimensional fax number . . . :wink:

http://tmxxine.tumblr.com/

Puppy Time
Always Now, Always Ready.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#3 Post by Geoffrey »

Lobster wrote::)
I was hoping to able to talk to time itself :shock:
Thanks for providing this, works well - sound not brill but theory is valid.

I am trying to think of an application - you know something like your backup will be ready at 'saytime' . . .

I know there will be a need for this when I build my time travel prototype . . . just got to wait for Cern to provide blue prints . . . and an inter-dimensional fax number . . . :wink:

http://tmxxine.tumblr.com/

Puppy Time
Always Now, Always Ready.
lol, yeah the sound files could be better, I noticed the word six is a little lacking, I was hoping to get the app size under 100k,
so I've just put it out there to see if anyone might like to have play with it, you never know something might come of it.

I have been using flite_time with pschedule set to tell me the time on the hour, I have a tendency not to look at the clock,
which in turn means I'm always running late for something, so I though there must be something that don't take up a lot of space
and this seems suitable for the task, well for it's size it probably worth having.

Geoffrey

edit: I copied the word six from the 16.wav, sounds a lot better than the original, just download it and remove the zip extension, it's not
a zip, wasn't worth compressing.
Attachments
6.wav.zip
I modified this removing a portion of the start as it took to long the other two people who downloaded it do so again
(2.22 KiB) Downloaded 671 times
Last edited by Geoffrey on Sat 08 Oct 2011, 14:14, edited 5 times in total.

stu90

#4 Post by stu90 »

Nice one - thanks Geoffrey 8)

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#5 Post by Geoffrey »

Mmmm, this may be better than I thought, just playing around with a script to run the saytime script and found that it can give it different effects.

By running it from another script with multiple instances and sleep statements will give it a echo effect similar to a railway station or stadium,
to try that add the path to top of the script, I have mine in /usr/share/talking_clock/ so the script looks like this.

Code: Select all

#!/bin/sh

cd /usr/share/talking_clock/

function sayHours() {
  aplay $1.wav
}

function sayMins() {
  tens=${1:0:1}
  units=${1:1:1}
    if [ ${#units} = 0   ]; then
    units=$tens
    tens="0"
  fi
  if [ $tens -lt 1 ]; then
    aplay $tens.wav
    aplay $units.wav
  elif [ $tens -lt 2 ]; then
    aplay $1.wav
  else
    tens=$tens"0"
    aplay $tens.wav
    if [ $units -gt 0 ]; then
      aplay $units.wav
    fi
  fi
}

function sayAMPM() {
  aplay $1.wav
}
  
hours=`date +"%-l"`
sayHours $hours
mins=`date +"%-M"` 
sayMins $mins
ampm=`date +"%-P"` 
sayAMPM $ampm
Then make a system link to it in /usr/bin/ and make another script with this in it,

Code: Select all

#!/bin/sh
saytime &
sleep .1
saytime &
sleep .1
saytime 
this script can be anywhere you like, just change the number of instances and sleep statements and timing to hear the the differences,
sounds quite good and actually covers up any imperfections in the sound files.

Geoffrey

edit: here is where I got the sound files from http://evolution.voxeo.com/tools/, to edit and convert them I used Audacity,
MhWavEdit
will also do it, they need to converted to "RIFF (little-endian) data, WAVE audio, Microsoft PCM, 8 bit, mono 8000 Hz],
and have the silence removed from the start and end of the files,this will nearly half the file size and allow aplay to use them.

I tried this code to play the clock, sounds really good. :lol:

Code: Select all

#!/bin/sh
saytime &
sleep .1
saytime &
sleep 0
saytime &
sleep 0
saytime &
sleep .1
saytime &
sleep 0
saytime &
sleep 0
saytime &
sleep .1
saytime &
sleep 0
saytime 
edit: I tried running it using mplayer instead of aplay, runs a little slower meaning more delay between words,
that being the case it will play 4bit wav files which would be half the size, so in theory should be able to get the app under a 100k
and no difference in sound quality, I haven't found a way to convert to 4bit RIFF (little-endian) data, WAVE audio, IMA ADPCM, mono 8000 Hz in puppy,
but can in windows with the appropriate software, can anyone tell me if there is anything available for linux to do the convertion to 4bit ?
also if running the multiple instances with mplayer can be a little extreme with the added delay, just food for thought, suggestions appreciated.

This is the web page that I got the clock script from http://www.jumpstation.co.uk/scripts/talkingclock/

User avatar
harii4
Posts: 448
Joined: Fri 30 Jan 2009, 04:08
Location: La Porte City, IA , U.S.A.
Contact:

#6 Post by harii4 »

I was looking for an chime-ing clock like an grandfatherclock-1.0.1-2_all.deb
but this sounds cool too and easyier. :D
3.01 Fat Free / Fire Hydrant featherweight/ TXZ_pup / 431JP2012
----------------------------------------------------------------------------------------
Peace and Justice are two sides of the same coin.

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

#7 Post by Moose On The Loose »

Just a comment before really looking into it in detail:

[quote="Geoffrey"]

Code: Select all

  tens=${1:0:1}
  units=${1:1:1}
    if [ ${#units} = 0   ]; then
    units=$tens
    tens="0"
  fi
you can also do:

Code: Select all

tens=$(( 100 + $1 ))
units=${tens:2:1}
tens=${tens:1:1}
Really it would be nice to pick apart the numbers and say them using things like "twelve" instead of "one two" for all but the fractional amounts of seconds. This sounds like a job for a case statement. If you name the sound files from Word0.wav to Word12.wav with a Teen.wav etc, it
seems like it wouldn't be a lot of code to do.

You can also use "espeak" to say the words but that would be a lot larger than just putting in the sound files.

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#8 Post by Geoffrey »

Hi Moose,

thanks for the code, definitely needs a rewrite, the problem I see with it is the fact that on the hour instead of saying for example, 5 AM it will say 5 OH OH AM
I've been scratching my head trying get around the problem, any help with this would be appreciated.

I think the beauty of making a talking clock this way is that there are no other dependencies needed, also one can create their own sound files.
Over all it don't sound all that bad, it's not as if it will be playing constantly so it doesn't need to be HIFI quality.
I was thinking of using mplayer for the sound but I think aplay is more suited to the task, it seems more responsive and is better suited for the echo effect.

I was also thinking that a simple GUI for presets to set the active period, on the hour etc, this only needs to amend /var/spool/cron/crontabs/root the same as pschedule,
also maybe some echo effects, these seem to give a bit more loudness to the sound, just a thought.

edit: I fixed the problem with OH OH on the hour, and used your replacement code.

Code: Select all

function sayMins() {
  tens=$(( 100 + $1 ))
  units=${tens:2:1}
  tens=${tens:1:1}
  zero="" 
  if [ $units = 0 ]; then
     zero="0"
  fi
  if [ $tens = $zero ]; then
    aplay blank.wav 
Added a blank.wav file, I might have a go at adding noon and midnight wave files also, the script now looks like this.

Code: Select all

function sayMins() {
  tens=$(( 100 + $1 ))
  units=${tens:2:1}
  tens=${tens:1:1} 
  zero=""  
  if [ $units = 0 ]; then
     zero="0"
  fi 
  if [[ $tens = $zero ]]; then
    aplay blank.wav
  elif [ $tens -lt 1 ]; then
    aplay $tens.wav
    aplay $units.wav
  elif [ $tens -lt 2 ]; then
    aplay $1.wav
  else
    tens=$tens"0"
    aplay $tens.wav
    if [ $units -gt 0 ]; then
      aplay $units.wav
    fi
  fi
}
function sayHours() {
  aplay $1.wav
}
function sayAMPM() {
   if [[ $mins = 0 ]]; then
    min="1"
    else
    min="0"
    fi
   if [ $hours = 12 ]; then
    hour="1"
    fi
   if [[ $min = $hour ]]; then
    type="m"
    else 
    type=""
   fi
   if [ $ampm = "pm" ]; then
    pmam="p"
    midnoon=$pmam$type
    else
    pmam="a"
    midnoon=$pmam$type
   fi 
   if [[ $midnoon = "am" ]]; then
    aplay midnight.wav
   elif [[ $midnoon = "pm" ]]; then 
    aplay noon.wav
   else 
   aplay $1.wav
   fi 
}
hours=`date +"%-l"`
sayHours $hours
mins=`date +"%-M"` 
sayMins $mins
ampm=`date +"%-P"` 
sayAMPM $ampm
edit: 10/11/2011 Added code for midnight and noon wav, will upload new wav file for midnight and noon.
Attachments
midnight.wav.zip
new edited wav file for the above script, not a zip, just remove the zip extension
(3.94 KiB) Downloaded 634 times
noon.wav.zip
new edited wav file for the above script, not a zip, just remove the zip extension
(3.51 KiB) Downloaded 690 times
blank.wav.zip
not a zip, just remove the zip extension
(46 Bytes) Downloaded 675 times
Last edited by Geoffrey on Tue 11 Oct 2011, 07:16, edited 2 times in total.

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

#9 Post by Moose On The Loose »

Geoffrey wrote:Hi Moose,

thanks for the code, definitely needs a rewrite, the problem I see with it is the fact that on the hour instead of saying for example, 5 AM it will say 5 OH OH AM
I've been scratching my head trying get around the problem, any help with this would be appreciated.
I'll take a run at making a function that does a little better. My idea is to have files with cleverly selected names. Lets see if I can do it. I'll come back perhaps later today with the results of my investigation.

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: Talking Clock

#10 Post by Moose On The Loose »

Here is my method. I made the script logic simple by making the file names match the numbers.

The file is flat (no directory structure)
Attachments
sayclock.tar.gz
(1.02 KiB) Downloaded 616 times

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Re: Talking Clock

#11 Post by Geoffrey »

Moose On The Loose wrote:Here is my method. I made the script logic simple by making the file names match the numbers.

The file is flat (no directory structure)
Moose, I was a little confused, then I realized that you are scripting for espeak, or am I wrong, I was using flite for a clock,
I just stripped out the lib files that the clock required, but it still is large just for a clock,
near 5meg and not the clock to use if you need to know the exact time, it sounds fluent,
but has no settings so what you hear is what you get.

I'm still proceeding with the wav file approach, so far I have updated it to say noon and midnight,
I'm in the process of writing a preferences GUI for it, I'll update the code in my previous post for the noon midnight change.

Geoffrey

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#12 Post by Geoffrey »

Uploaded a package for the saytime script, please test it and let me know how it works for you, see first post.

Geoffrey

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: Talking Clock

#13 Post by Moose On The Loose »

Geoffrey wrote:
Moose On The Loose wrote:Here is my method. I made the script logic simple by making the file names match the numbers.

The file is flat (no directory structure)
Moose, I was a little confused, then I realized that you are scripting for espeak, or am I wrong,

Geoffrey
You are wrong. I was showing the method. In the script file, you will see the variables PLAYER and SUFF. With these, you can make it print text as I did or say the words. Just change the PLAYER to be a wave file player, make SUFF to be "wav" and use wave files in place of the text files.

I wanted to demonstrate the method quickly so I did the text version.

gcmartin

Interesting Gadget

#14 Post by gcmartin »

Could one suggest how to insert this into the system to be an active system activity?

thre's also the taskbatr clock, could this be a feature of that clock or a replacement of that clock?

Is this a PET?

Thanks in advance

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Re: Interesting Gadget

#15 Post by Geoffrey »

gcmartin wrote:Could one suggest how to insert this into the system to be an active system activity?

thre's also the taskbatr clock, could this be a feature of that clock or a replacement of that clock?

Is this a PET?

Thanks in advance

Yes it is a pet, see first post, when installed it will say the time on the hour in a AM/PM format, with a American female accent.

If you look in the menu under system there is a item called "Say Time Config" that will let you to select from 3 different echo effects, default being no effect,

select the effect to use and press play to listen to them, setup will open pschedule where you can change the activity time for the clock.

Typing "say_clock_time" in the terminal will say the time also, if for any reason you lose the pschedule task just add a new "say_clock_time" command

I didn't make this as a replacement for the task-bar clock, just as a separate feature, as I don't look at the clock all that often.

It isn't all that elaborate but seems to work ok, hope you find it useful.

Geoffrey

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#16 Post by Geoffrey »

Updated the script to fix problem running in Slacko53

see first post for new saytime-1.1.pet

Geoffrey

gcmartin

installed Talking Clock but GUI locks the desktop

#17 Post by gcmartin »

Running SLACKO 5.3.

Downloaded the Tlaking Clock.PET. But, when Menu > System > Set Time Config brings the GUI onto desktop, clicking "Play" or ... locks the destkop.

Not sure why?

Hope this helps

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

Re: installed Talking Clock but GUI locks the desktop

#18 Post by Geoffrey »

gcmartin wrote:Running SLACKO 5.3.

Downloaded the Tlaking Clock.PET. But, when Menu > System > Set Time Config brings the GUI onto desktop, clicking "Play" or ... locks the destkop.

Not sure why?

Hope this helps
Strange thats what happened with me , thats why I updated to version 1.1, it's working for me.
I'm using Slacko to post this and the clock is working fine, originally it didn't work from the menu but worked by going to the install directory and running it there.
I'll have to test it on a clean boot again, oh! you didn't say which version you installed , you may have got the old one before I updated it.

Anyway I'll sort it out.

Geoffrey

edit: I just tried it again with a fresh boot, working fine with version 1.1, I assume that you must of used the old version 1.0

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#19 Post by 01micko »

Hi Geoffrey

Working fine here.. guess what pup I'm running? :)

Cheers
Puppy Linux Blog - contact me for access

User avatar
Geoffrey
Posts: 2355
Joined: Sun 30 May 2010, 08:42
Location: Queensland

#20 Post by Geoffrey »

01micko wrote:Hi Geoffrey

Working fine here.. guess what pup I'm running? :)

Cheers
Hi 01micko,

Good, yeah I didn't think it was broken again, I had to put ampersands on the end of the button commands to stop the lockup,

which I neglected to do in the previous version, I also put a system link in /usr/bin, I didn't put a great deal of thought into it originally,

I've had few more Ideas for it, but need to see how things pan out before implementing them.

Apart from the wav files I'm trying to keep so that nothing else is needed other than what is in puppy already.

Well what I am looking at doing is different sound file packages that can be selected,

as well as a spoken format change to make more pleasing to the ear, this may take a while to do

Now Sean Connery would be a nice sounding clock, does anyone know him :lol:

Geoffrey

PS: this what I was thinking of

Words required for a talking clock:

THE TIME IS NOW
AM (optional for other functions)
PM (optional for other functions)
NOON
MIDNIGHT
IN THE MORNING
IN THE AFTERNOON
IN THE EVENING
AT NIGHT
OH
ONE
TWO
THREE
FOUR
FIVE
SIX
SEVEN
EIGHT
NINE
TEN
ELEVEN
TWELVE
THIRTEEN
FOURTEEN
FIFTEEN
SIXTEEN
SEVENTEEN
EIGHTEEN
NINETEEN
TWENTY
THIRTY
FOURTY
FIFTY

If only I had good voice :lol:

Post Reply