This is a pro-tip that I picked up from Aaron Lerch - using the
say voice synthesis command after a long-running command-line task. Often times, at work, I'll have to run some sort of compilation process that can take anywhere from a few seconds to a few minutes. And, in order to maximize my productivity, I'll use this compilation "down time" to perform other duties. However, so as to not let myself go down a rabbit hole, I'll append the
say command so that I am alerted to the completion of the compilation.
A few months ago, I took a look at using the Voice Synthesis API in the browser. On the Mac, at least, this API is built on top of the
say command that ships with the Mac OS. The
say command allows us to convert text-to-speech using a variety of voices and pitches (and probably a number of other settings that I've never tried).
So, for example, to get the computer to speak out loud, we could just enter the following command in our terminal window:
say "Oh sweet chickens"
After some trial-and-error, I've found that I enjoy the Fiona voice the most. So, I might write the same command as such:
say --voice Fiona "Oh sweet chickens"
Now, getting back to how this helps me stay productive with long running tasks on the command-line, we can use the
&& operator to run a series of tasks in sequent on the command-line. Which means, I can run the
say command right after my long-running task.
sleep command to simulate a long-running command-line task, I can do something like this:
sleep 3 && say --voice Fiona "Done processing, back to work"
This will sleep the process for 3-seconds and then, upon completion, execute the
say command. And, since I have my headphones in while I work, I'll immediately be alerted to the fact that my long-running task has completed its execution.
To make this easier we can alias the
say command and its arguments:
alias ondone="say --voice Fiona 'Done processing, back to work'"
Which means that I can then simplify the rest of my command-line tasks like this:
sleep 3 && ondone
Having the command-line alert me to the fact that it's done processing is helpful for my productivity because it allows me to switch back-and-forth between mental gestures without overhead. Thanks to Aaron for this hot tip!
say --voice Fiona 'Great tip! Thanks for sharing'
For Windows, I already use many NirSoft utilities (view WiFi password history, convert CSV to TSV, etc) and I found that their core NirCmd utility has a "speak" function. It's a little robotic and not as nice as the built-in Microsoft speech synthesis (or Fiona), but sounds better than the default Mac voice.
I previously used blink(1), a small full-color RGB LED, to flash different colored patterns to visually notify me when things were triggered server-side. The only downside was the host server for the API had to be my development station (where the light was connected) so it didn't work very well for remote notifications due to firewalls.
You are the master of all things command-line :D Thanks for sharing the Windows-oriented approach. Using an LED sounds fun. I remember when the Raspberry-Pi came on the scene, people went mad for LED shenanigans.
I had to Google for "TSV" - I don't think I've ever seen that extension used before. I've always just used "CSV" generically to mean basically any delimited list style data format.