Module: Azure::TTS
- Includes:
- Constants
- Defined in:
- lib/azure/tts.rb,
lib/azure/tts/api.rb,
lib/azure/tts/token.rb,
lib/azure/tts/errors.rb,
lib/azure/tts/voices.rb,
lib/azure/tts/speaker.rb,
lib/azure/tts/version.rb,
lib/azure/tts/constants.rb,
lib/azure/tts/configuration.rb
Defined Under Namespace
Modules: Constants
Classes: API, Configuration, Error, RequestError, Speaker, Token, TokenAuthMiddleware, Voice, Voices
Constant Summary
collapse
- VERSION =
"1.0.0"
Constants included
from Constants
Constants::AUDIO_FORMATS, Constants::REGIONS, Constants::TOKENS_URL, Constants::TTS_URL, Constants::VOICES_URL
Class Method Summary
collapse
Class Method Details
.api ⇒ Object
46
47
48
|
# File 'lib/azure/tts.rb', line 46
def api
@api ||= API.new
end
|
.config ⇒ Object
23
24
25
|
# File 'lib/azure/tts.rb', line 23
def config
@config ||= Configuration.new
end
|
27
28
29
30
|
# File 'lib/azure/tts.rb', line 27
def configure
yield(config)
reset
end
|
.reset ⇒ Object
50
51
52
53
54
|
# File 'lib/azure/tts.rb', line 50
def reset
@api = nil
@voices = nil
@token = nil
end
|
.speak(text:, voice: nil, locale: nil, gender: nil, neural: nil, format: :audio_24khz_160kbitrate_mono_mp3) ⇒ Object
rubocop:disable Metrics/ParameterLists
36
37
38
39
|
# File 'lib/azure/tts.rb', line 36
def speak(text:, voice: nil, locale: nil, gender: nil, neural: nil, format: :audio_24khz_160kbitrate_mono_mp3) voice ||= voices.find(locale: locale, gender: gender, neural: neural)
Speaker.new(text: text, voice: voice, format: format).speak
end
|
.token ⇒ Object
41
42
43
44
|
# File 'lib/azure/tts.rb', line 41
def token
@token ||= Token.new
@token.tap(&:refresh)
end
|
.voices ⇒ Object
32
33
34
|
# File 'lib/azure/tts.rb', line 32
def voices
@voices ||= Voices.new
end
|