In terminal, how to get “say” to say things “right” ? ie using custom phonetics

terminaltext;voice

I'd like to use "say" in the terminal to create audio files with a custom phonetic dictionary, or at the very least, say things how I think they should sound. From my understanding, this can't be accomplished through the "Voice Over Utility" configuration screen.

So to have say "speak" things correctly, I'm willing to:

  • use a custom phonetic dictionary or
  • change my input text to some phonetic variant

For example, I'd like to be able to have the word "colossians" said as I expect it, which is phonetically something like "kuh LOSH uhnz" without the pauses that the spaces cause in the word.

Best Answer

The Speech Synthesis Programming Guide describes the embedded speech commands that you can use to adjust how the speech synthesis engines process your input text.

The [[inpt PHON]] command enables the use of phonemes and phoneme modifiers.

For example, the following text includes a phonemic version of your chosen word (select the text, Control-click, and select Speech > Start Speaking to hear it directly in Safari):

If you don't like how I say "colossians",
then perhaps you will be satisfied with
"[[inpt PHON]]kUH2lAASUHnz[[inpt TEXT]]".

This syntax is accepted by the say command in the shell and AppleScript (though you will have to modify the (above) use of single- and double-quotes to suit the string literal syntax of your chosen context).