A little-known Linux command that comes with Ubuntu is espeak (and just in case you don’t have it for some reason, it is readily available in the repositories). No, it’s not a mind-numbingly useful command that will suddenly replace the need for seven of your GUI apps, but more of a novelty (that I don’t doubt could actually be put to some serious applications).
It is simply a command-line tool that will give you audio output in a robotic voice to whatever you type after espeak in the terminal. Like I said, nothing earth-shattering, and OK, you could probably get bored of it fairly quickly. But the purpose of this post is just to bring it to the attention of those who don’t even know it is on their system, and to give some tips on its use.
Now, if you enter one word after the command, it will of course just say that word. But if you type in a bunch of words without quotes, it will still only say the first word it finds. Also, it will say words at an even (yes, robotic) pace, and while it will add pauses according to punctuation, you can do a little more to add a more human feel to it. What this means is that while adding commas and periods as you usually would results in expected pauses, sometimes in speech we add slight pauses for emphasis that would be grammatically incorrect if transferred to written (or typed) word. Basically, what I do is type/paste as I would write it, and for added pauses I use a hyphen (-).
Also, just as you would end a question with a question-mark (?), do so with espeak and the robotic voice will have a querying inflection. So here and there you may even want to add it to words mid-sentence, which you wouldn’t dream of usually. For example, “Oh why, why, why?” will sound quite different from “Oh why? why? why?“. And sometimes adding a ? to the end of a question just doesn’t sound right, so needs to be replaced with a period. Just play around with things like this till you get it sounding as you want. And remember, you don’t need to retype it each time – just hit your UP arrow key on your keyboard and the previous command will appear in the terminal (and you can then use your other arrow keys to get to characters you want to use the Backspace or Delete key on before inserting new characters).
So here is an example you can copy then paste into a terminal:
espeak "Oh why? why? why the hell is my house on fire? I think I better call the fire brigade. Uh – oh! It looks like its going to explode"
Note the incorrect grammar of its, as it’s ended up sounding like a quick it is. And try it with the hyphen removed from Uh – oh! and see what a difference it makes!
Also, while you can see that in the middle of the command an exclamation mark (!) is fine, if you end the string of text with one, you will likely encounter this error:
bash: !”: event not found
Once you’ve had a play around with espeak, you can always find clever ways to utilise it, like add it to alarm scripts and whatever else you can think of. And let’s not forget you can actually get it to read text files out aloud for you! Just enter in the terminal:
espeak -f text.txt (replacing text.txt with the actual filename, and adding the path to it if you didn’t open the terminal in that folder).
Did this information make your day? Did it rescue you from hours of headache? Then please consider making a donation via PayPal, to buy me a donut, beer, or some fish’n’chips for my time and effort! Many thanks!