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?
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?
This is the list of available voices:
say -v '?'
for voice in `say -v '?' | awk '{print $1}'`; do say -v "$voice" "Hello, my name is $voice."; done
Python Version, courtesy of Barry Wark:
from AppKit import NSSpeechSynthesizer
print NSSpeechSynthesizer.availableVoices()
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
...
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.
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
© 2022 - 2024 — McMap. All rights reserved.