Back in January, “3dEyes**” posted a program on BeBits called eSpeak, which is a port of an open-source speech synthesizer. As anyone who as used SimpleText on a Mac knows, text-to-speech is fun to play with for a little while, but there’s not much practical use for it aside from specific niches like screen-reader applications for the blind (or old Radiohead songs). Today, though, I found a handy use for the “speak” program – for audio notifications when tasks have completed in the Terminal.

Read on for the details.

By nature and by necessity, I tend to be an obsessive multi-tasker – combined with heavy use of workspaces in BeOS and the use of a KVM switch (to run a BeOS and a Windows machine side-by-side with the same keyboard, monitor, and mouse), it’s quite easy to lose track of specific tasks. Especially when topped-off with a serious case of Nerd Attention Deficit Disorder Often, I’ll start a task that requires some time to complete – such as a svn checkout, compiling a program, downloading a website via FTP with wget, etc – and then switch to something different and forget about the first task until an hour or two later.

Today, I wanted to make an attempt at grabbing and compiling the latest Tranmission source from SVN. I figured that both tasks would take a fair amount of time, so I wanted to run those proesses in the background but still get some sort of notification when they finished. After playing around with the “alert” and “beep” commands, the obvious solution occurred to me – why not just use eSpeak to make the computer verbally announce when it’s finished?

Next I did some quick testing to make sure the scheme would work. The first thing I tried was to open up a Terminal and run the following command (from my home/ folder):

ls && speak "all done"

The meaning of command should be fairly self-evident to most people who are familiar with the Terminal; the “ls” command lists all the files in the current folder, the “&&” operator tells the Terminal to run another command after the previous one has completed, and the “speak” command reads the words “all done” using the eSpeak synthesizer. So in the example above, the file listing should be displayed and then you should hear the words “all done” from your speakers.

In order to use it for my original purposes, I ran the following commands:

svn co svn:// Transmission && speak "finished check out"
cd Transmission
configure --prefix=/boot/home/config && make && speak "stick a fork in me I'm done"

It worked quite well – after each command finished, the “speak” program notified me out loud. Since both the checkout and the configure/make took several minutes apiece, I was free to switch away from the Terminal window while still being immediately aware that the commands had finished (without having to to watch the terminal window the whole time, that is).

A few other examples:

wget && speak "finished"

That would download a file using wget and read a notification when done.

lame -b 192 file.wav && speak "finished"

That would encode an MP3 with LAME and read a notification when done.

ls | speak -p 25

If run in a directory with many files, that would make your computer sound like Orson Welles speaking in tongues. Okay, that one isn’t really practical – but it is strangely amusing.

Those are just a few quick examples off the top of my head, I’m sure that those who have more Terminal skillz can think of even better ways to make use of eSpeak. If you think of any clever ideas, please post them in the comments.

Category: Guides & Howtos   -   Comments RSS   -   Post a Comment   -   Trackback  

« »