Class: FreeTTS::Voice

Inherits:
Object
  • Object
show all
Defined in:
lib/freetts/voice.rb

Constant Summary collapse

DEFAULT_NAME =
"kevin16"
ACCESSIBLE_ATTRIBUTES =
%w( age description domain duration_stretch
gender locale name organization pitch 
pitch_range pitch_shift rate run_title style
volume )
MODIFIABLE_ATTRIBUTES =
%w( duration_stretch pitch pitch_range pitch_shift
rate volume )

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(voice) ⇒ Voice

Returns a new instance of Voice.



44
45
46
# File 'lib/freetts/voice.rb', line 44

def initialize(voice)
  @voice_impl = voice
end

Class Attribute Details

.voice_managerObject (readonly)

Returns the value of attribute voice_manager.



13
14
15
# File 'lib/freetts/voice.rb', line 13

def voice_manager
  @voice_manager
end

Class Method Details

.allObject



15
16
17
# File 'lib/freetts/voice.rb', line 15

def all
  voice_manager.get_voices.map { |voice| voice.get_name }
end

.for_name(voice_name) ⇒ Object



19
20
21
22
23
24
25
26
27
# File 'lib/freetts/voice.rb', line 19

def for_name(voice_name)
  voice = voice_manager.get_voice(voice_name)
  if voice
    voice.allocate
    Voice.new(voice)
  else
    raise "No voice found for name \"#{ voice_name }\""
  end
end

Instance Method Details

#speak(saying) ⇒ Object



48
49
50
# File 'lib/freetts/voice.rb', line 48

def speak(saying)
  @voice_impl.speak(saying)
end