GTD Goodness: Get the computer to tell you the time

Rich Mintz (richmintz.com seems empty) gave me a great tip for keeping focused. He’s a Mac user and OS X makes it easy to get the computer to say the time every 15 minutes. It isn’t so easy on Ubuntu, but it is doable. Since I put this in place, I’ve found that it does help me focus more. It can also help keep me from working too late (not that it has yet). Anyway, here is the bit of magic that you need:

(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|espeak --stdout|sox -q -V0 -t wav - -t alsa pulse")|crontab -

Update:

(crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|padsp espeak")|crontab -

will also work, but you may get emails filled with error messages from cron. Breaking it down

  1. (crontab -l; ...) | crontab -
    This part dumps the current crontab out, appends the new line (elided here, see the next step) and then, with the “crontab -” after the pipe, creates an entirely new crontab with the results. This way, we just add a new cronjob to the list of ones you may already have.
  2. echo "0,15,30,45 * * * * ..."
    The first part of any crontab file gives a schedule for execution. Since I just want this to run every 15 minutes, I haven’t set up anything besides that, but you could tell it “only during business hours during the work week” which might look something like “0,15,30,45 9-17 * * 1-5“. I recommend you RTFM for help on that, though.
  3. (echo it is now;date \+\%I:\%M\%p )
    Print out two lines that are what you’ll hear. If you don’t want to hear “It is now”, then you can leave out that echo statement and the parenthesis. The date command just formats the current time in HH:MM AM/PM time format. One problem is that at the top of the hour you have “00” which the synthesizer reads as “zero zero”. Oh well, all is not perfect.
  4. | espeak --stdout
    Every 15 minutes when the cron job is run, espeak reads the bit from date and produces a wav file with the sounds that your computer should play. Normally, espeak would just play this out on your speakers, but you might be listening to music. If the speakers were otherwise engaged (by, say, Rhythmbox), then you won’t hear the sound and cron will send you an email full of strange error messages.
  5. | sox -q -V0 -t wav - -t alsa pulse
    To get the sound to mix properly with other sound apps, it has to play out through pulseaudio (the new, default sound server in Hardy). Strangely enough, even though pulseaudio was supposed to Fix the Linux audio mess once and for all, we still have to jump through hoops.

There is a chance that saytime will just work for you. But, because of that “audio mess” that still exists in Ubuntu, it didn’t work for me.

7 thoughts on “GTD Goodness: Get the computer to tell you the time”

  1. about the audio mess

    dont you just need padsp to make espeak go through pulseaudio
    ie run
    padsp espeak
    and start typing stuff to check it out. so replace espeak with padsp espeak

      1. Re: about the audio mess

        that would be nice, i dont know if it is doable though

        i mean, everything does work now, you just have to know about oss needing padsp
        before when there was no pulseaudio i think it needed aoss before it to make oss go thought alsa, and on kde it needed arts-oss or something. so nothing has really got worse, it seems to be a fundamental problem in oss that it needs to be done with the extra loading thing.

        1. Re: about the audio mess

          everything does work now, you just have to know about oss needing padsp

          See, that’s the very definition of something not “just working”. No special knowledge should be needed to make something “just work”.

          And I expect Ubuntu to “just work”.

  2. You’ll have to clarify what you mean. To use it, you run

    (crontab -l;echo "0,15,30,45 * * * * (echo it is now;date \+\%I:\%M\%p)|espeak --stdout|sox -q -V0 -t wav - -t alsa pulse")|crontab -

    from the command line. From that point on, your computer should speak the time to you every 15 minutes.

    Which means, you don’t end up in a timesink, like reading stupid reddit links, without being reminded of the passage of time.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.