Class: TermuxRubyApi::SubSystems::Tts

Inherits:
Base
  • Object
show all
Defined in:
lib/termux_ruby_api/sub_systems/tts.rb

Instance Attribute Summary

Attributes inherited from Base

#owner

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from TermuxRubyApi::SubSystems::Base

Instance Method Details

#enginesArray <Hash>

Returns the list of available engines



28
29
30
# File 'lib/termux_ruby_api/sub_systems/tts.rb', line 28

def engines
  owner.json_api_command('tts-engines')
end

#speak(text, engine: nil, language: nil, region: nil, variant: nil, pitch: nil, rate: nil, stream: nil) ⇒ Object

Speaks a text through the TTS system



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/termux_ruby_api/sub_systems/tts.rb', line 14

def speak(text, engine: nil, language: nil, region: nil, variant: nil, pitch: nil, rate: nil, stream: nil)
  args = owner.generate_args_list([['-e', engine&.to_s],
                                   ['-l', language&.to_s],
                                   ['-n', region&.to_s],
                                   ['-v', variant&.to_s],
                                   ['-p', pitch&.to_s],
                                   ['-r', rate&.to_s],
                                   ['-s', stream&.to_s]
                                  ])
  owner.api_command('tts-speak', text, *args)
end