class TermuxRubyApi::SubSystems::Tts

Public Instance Methods

engines() click to toggle source

Returns the list of available engines @return [Array <Hash>]

# 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) click to toggle source

Speaks a text through the TTS system @param text [String] the text to be spoken @param engine [String] the engine to use (see engines) @param language [String] the string code for the language to use @param region [String] the string code for the regional variaion of the selected language @param variant [String] the voice of the selected language @param pitch [Fixnum] the desired pitch: 1 neutral. <1 more grave. >1 more acute @param rate [Fixnum] the desired speak rate. 1 neutral. <1 slower. >1 faster @param stream [String] Android audio stream to use: One of ALARM, MUSIC, NOTIFICATION, RING, SYSTEM, VOICE_CALL

# 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