32

The mac command say can specify the voice used with the -v flag.

say -v Alex "compile completed, put your swords down."

The available voices can be seen in System Preferences/Speech/Text to Speech. How can I get this list programmatically?

0

8 Answers 8

103

This is the list of available voices:

say -v '?'
1
  • Not on 10.6. (SO 15 char filler text)
    – mankoff
    Mar 19, 2013 at 15:18
26
for voice in `say -v '?' | awk '{print $1}'`; do say -v "$voice" "Hello, my name is $voice."; done
11

Python Version, courtesy of Barry Wark:

from AppKit import NSSpeechSynthesizer
print NSSpeechSynthesizer.availableVoices()
7

Shell Version, no hack too cheap!

(Don't actually use this, use the python version instead.)

ls /System/Library/Speech/Voices | sed 's/.SpeechVoice$//'

Agnes
Albert
Alex
BadNews
Bahh
Bells
Boing
...
6

[NSSpeechSynthesizer availableVoices]

3
  • nice! This wouldn't be callable via python by any chance? Sep 29, 2009 at 0:44
  • I'm sure you could call it through PyObjC, which is included with Mac OS X 10.5 and above (and downloadable for earlier versions).
    – Chuck
    Sep 29, 2009 at 0:48
  • you're right, I've copied the incanation below... thanks a bunch!! Sep 29, 2009 at 4:50
2

It is worth going through several of the voices before deciding on one. There is a huge variation in quality.

For example, Tom sounds a bit impatient, but way more realistic than Alex. And some of the British voices are great.

Using say -v '?' gives you a list of the installed voices plus some sample sentences that give you an idea what to expect of the voice. You have to go through preferences to install most of the really good voices, but they come with a Compact voice file that lets you hear what each voice sounds like before you actually download them.

2

You can use the following to sample all the available voices:

say -v '?' | awk '{$2=$3=""; printf "-v %s", $1; $1=""; print " \"" $0 "\""}'| xargs -L1 say
0
for i in `say --voice=? | cut -f 1 -d' ' ` ; do  
  echo $i;  say --voice=$i $i
done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.