The text-to-speech function in Mac OSX works in command line too.
A simple say
command with a string provided:
1 | $ say "Thank you for calling us. We are currently unavailable to take your call. Please leave us a message and we'll return your call as soon as possible." |
We can control the speaking rate in words per minute:
1 | $ say "Thank you for calling us. We are currently unavailable to take your call. Please leave us a message and we'll return your call as soon as possible." -r 180 |
We can export the speech audio into file:
1 | $ say "Thank you for calling us. We are currently unavailable to take your call. Please leave us a message and we'll return your call as soon as possible." -r 180 -o ~/Desktop/voice-message-en.aiff |
We can provide an input file instead of using the string parameter:
1 | $ say -f voice-message.txt
|
We can specific which voice to use. And specifying “?” lists all the voice options:
1 | $ say -v ?
|
For instance, I can have a Cantonese text-to-speech with the voice “Sin-Ji”:
1 | $ say -f voice-message.txt -v "Sin-ji" --rate=70 |