Tuesday, July 7, 2015

Speaking Alarms for OS X


Speaking Alarms for Windows have been found useful. In Version 0.9.5 of Artisan, the "Call Program" alarm action has been updated to achieve a similar effect on OS X.

There is no need to install an extra software on OS X as it is required on Windows to make Artisan speak. Every Mac system since its introduction in 1984 came with MacinTalk, Apple's text-to-speech engine and a newer much improved variant is still installed with any OS X system.

On OS X text-to-speach can be accessed "programmatically" by just typing the following 
(without the prompt #) into a Terminal.app window.

# say Hello

By default text-to-speach uses the voice selected in the System Preferences as "System Voice" under Speech. But a different voice can be selected by specifying an optional argument. OS X comes with some english voice pre-installed (Alex, Vicki, Victoria). However, male as well as female voices for other languages can be downloaded and installed under the "Customize…" menu item.




The female voice Slivia can be selected to say "hello" in Italian using an optional argument.

say -v Silvia Ciao!

In Artisan, you can add alarms (menu Config >> Alarms) that run the say command of OS X as alarm action. Just choose "Call Program" as action. By default, Artisan's Call Program feature on OS X  expects the program specified under "Description" to be next to the Artisan.app. However, you can also specify the full path to the program that should be executed. For the "say" command this would be "/usr/bin/say" (without the quotes).



Alternatively you can write a small script that calls "say" and put it next to the Artisan.app. For this start TextEdit and type the following two lines

#!/bin/sh
say $@ &

and save this under "say" (without the standard .txt extension) in the same folder next to the Artisan.app. You also need to make this script executable by typing the following into the Terminal.app. Without the prompt #.

# cd /path/to/the/directory/of/the/say/script
# chmod +x say

With this script in place, you can simplify the "/usr/bin/say" to "say" and using the default voice you just use a "Description" like "say set heat to 95 percent".