Invoke System TTS in Ruby
I want to make a small app where I give him a set of English words and he can randomly read out the words inside. The reason why I have such an idea is that when I was learning English, I wanted to find a word dictation app, but I couldn't find the right one, so I might as well try to get one myself.
So I went looking for a tool to call TTS (text to speech). After a brief investigation, I found that Festival TTS is available in Linux, and Windows 7 has a TTS module by default, so we can call the system's TTS directly.
I'm going to use Ruby to call the system TTS.
Festival TTS can be used under Linux Reference festivaltts4r
"I love you".to_speech
Windows 7 should have a TTS by default, so let's just call the system one directly. First install a gem:
gem install win32-sapi
It's easy to use:
v = SpVoice.newv.Speak("Let's go for lunch")
It is said that Mac comes with a very good TTS, try again when you have a chance.