A talking clock.

Download File

NOTE: If you get locale errors then it's an interface issue between Tasker and your TTS libraries, try uninstalling all the TTS apps you have and rebooting, then try again. Then try reinstalling them one by one.

A profile for a full talking clock that says to/from depending on whether it's before/after the half hour, says "quarter" on the quarters, "half" on the half and "O'Clock" on the hour.

It'll adapt to a 24-hour clock as well and speaks everything in 12-hour format (easily modified).

I've set this up as a profile attached to the hourly chime profile so it automatically speaks the time on the hour. I've also saved it as a widget so I can have the spoken time whenever I want.

The code is functional but feels hugely inefficient (an "IF/OR" function would make it shorter) - please correct me if you can improve it!

Entries are:

1. Variable Split: Name = %TIME Splitter = .

2. Variable Set: Name = %TIME1 To = %TIME1 / 1 (Removes the leading zero or it sounds odd)

3. Variable Set: Name = %TIME2 To = %TIME2 / 1 (Removes the leading zero or it sounds odd)

4. Variable Subtract: Name = %TIME1 Value = 12 * IF %TIME1 > 12 (Convert from 24hr)

5. Variable Set: Name = %TIME2 To = word * IF %TIME2 = 00 (Placeholder for "O'Clock")

6. IF = %TIME2>30 (Subroutine for anything saying "xx minutes TO the hour")

7. Variable Add: Name = $TIME1 Value = 1 (We want the following hour for the "to")

8. Variable Subtract: Name = %TIME1 Value = 12 * IF %TIME1 > 12 (Change 13 O'Clock into 1 O'Clock)

9. Variable Set: Name = %TIME2 To = 60 - %TIME2 (Convert to "to" minutes)

10. Variable Set: Name = %TIME2 To = Quarter * IF %TIME2 = 15 (Say "Quarter" instead of 15)

11. Say: Text = "The time is %TIME2, to %TIME1."

12. Stop (Don't go any further and exit the profile)

13. Endif (End of the subroutine)

14. If = %TIME2 < 30 (Subroutine for anything saying "xx minutes PAST the hour")

15. Variable Set: %TIME1 = 12 * IF %TIME1 ~ 0 (Set to 12 if it's 24hr midnight)

16. Variable Set: Name = %TIME2 To = Quarter * IF %TIME2 = 15 (Say "quarter")

17. Say: Text = "The time is %TIME2 past %TIME1."

18. Stop

19. End If.

20. Say: Text = "It's half past %TIME1." * IF %TIME2 = 30

21. Say: Text = "The time is %TIME1 O'Clock." * IF %TIME2 = word

By SteveNZ

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License