Class: ESpeak

Inherits:
Object
  • Object
show all
Defined in:
lib/gaddygaddy-client/espeak.rb

Class Method Summary collapse

Class Method Details

.speak(to_speak) ⇒ Object



20
21
22
23
24
25
# File 'lib/gaddygaddy-client/espeak.rb', line 20

def self.speak to_speak
  file_name = to_speak.to_ascii.replace_whitespace('-').gsub('/','-')
  wav_file = "/tmp/#{file_name}.wav"
  `/usr/bin/espeak -w #{wav_file} "#{to_speak}"` unless File.exist?(wav_file)
  `/usr/bin/timeout -k 20 15 /usr/bin/aplay #{wav_file}`
end