Ben is a lifelong Nintendo fan who likes to build websites, and make video games. He buys way too much Lego.
I recently learnt that when you type
'Say' followed by some words into the terminal on MacOS your computer speaks to you. It’s like I’m in the future or something.
I like the idea that my Mac is distantly related to Jarvis from Iron Man so I thought I would get it to talk to me during the build process. Since the build can take over 10 minutes its easy to start it running and forget it’s happening, so it’s helpful to get notifications that the different stages have completed.
Using Bash means it’s trivial to add the commands. I simply add some new lines that start with
say in the positions that I want them to occur throughout the script.
I have updated the original post to show the code with the
say commands included.
If you’re interested in using
say in your own projects then there are a couple of parameters you can set. Mostly it’s just for changing the voice used. Theoretically you could setup your computer to have a conversation with itself since you can use different voices per line.
Unfortunately there’s no way (that I can see) to apply emphasis or other tonal variations to words or phrases – so the messages are all delivered in the same way – but it’s a nice start to making a complex process a bit more personal. And it means I know what’s happening without having to keep watching the Terminal.