Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

So I've been looking around on how to change how my mac says things, I have found my answer but what I need is some help with the coding. Here is what I want to do:

  • Create a list of word pairs.

  • Create a script that substitutes words in its parameter list according to your word-pairs list, and passes the modified parameter list to "/usr/bin/say".

I This is a quick copy of and I have very little coding know how and would like some help. I don't care in what language.

Any help would be really appreciated. Thanks in advanced.

share|improve this question
How do you want to use it? From the command line? – Daniel Beck Nov 27 '11 at 7:34
possible duplicate of How can I change how OS X's 'say' pronounces a word? – Ƭᴇcʜιᴇ007 Nov 28 '11 at 0:42

Create a file and enter the following:

#!/usr/bin/env bash
while read line ; do
    TEXT="$( echo $TEXT | sed "s${line}g" )"
done < "/path/to/rules.txt"
/usr/bin/say $TEXT

Make this file executable from the command line by running chmod +x

Create a file rules.txt where you specified in the above script (4th line) and enter substitution rules like the following:

|one thing|other thing|
|Apple Mac|Apple Macintosh|

The order of rules is important, as they are applied in order.

Run as /path/to/ foo Mac to have your Mac say "Apple Macintosh"

share|improve this answer
Of course, this completely ignores e.g. word boundaries of case-insensitivity. But your question really didn't contain enough information on how to handle those. – Daniel Beck Nov 27 '11 at 7:45
I want to be able to have it execute to before the normal say file so I can change pronunciation of the normal say command, if that is possible, so I could have the changes in Safari or Mail. – user106990 Nov 28 '11 at 1:53
@user these applications use programming Apis internal to OS x and don't use say. You'd need to patch your operating system and that is more or less impossible. It seems you're out of luck then. – Daniel Beck Nov 28 '11 at 7:03
Oh, well that is very disheartening. Not much I can do. – user106990 Nov 29 '11 at 0:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .