Getting list of Mac text-to-speech voices programmatically?

Viewed 17859

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?

8 Answers

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
for i in `say --voice=? | cut -f 1 -d' ' ` ; do  
  echo $i;  say --voice=$i $i
done
Related