class Belphanior::Servant::Speech::Adaptors::Espeak

Public Class Methods

new(syscall=nil) click to toggle source
# File lib/belphanior/servant/speech/espeak.rb, line 10
def initialize(syscall=nil)
  @syscall = syscall
  if not @syscall
    @syscall=Kernel
  end
end

Public Instance Methods

say(message, speech_properties={}) click to toggle source
# File lib/belphanior/servant/speech/espeak.rb, line 17
def say(message, speech_properties={})
  args=""
  if speech_properties.has_key?(:voice)
    args += "-v \"#{speech_properties[:voice]}\" "
  end
  command_line = "espeak #{args}\"#{message}\""
  result = @syscall.system(command_line)
  if not result
    raise Exception,
    "Error in say: Tried to shell '#{command_line}', but "
    "result was '#{$?}'"
  end
end