Sha256: d6276ca0a105e70a7bbbbe510fd8e529706f0e0f9cff423d1df4a568d25564a0
Contents?: true
Size: 796 Bytes
Versions: 1
Compression:
Stored size: 796 Bytes
Contents
# frozen_string_literal: true module Azure module TTS class Speaker def initialize(text:, voice:, format:) @text = text @voice = voice @format = format end def speak response = Azure::TTS.api.tts.post(nil, ssml, headers) raise RequestError, response unless response.success? response.body end def ssml ssml = RubySpeech::SSML.draw ssml.voice gender: @voice.gender, name: @voice.short_name, language: @voice.locale, content: @text ssml.to_s end def headers { "Content-Type" => "application/ssml+xml", "X-Microsoft-OutputFormat" => Azure::TTS::AUDIO_FORMATS[@format], "User-Agent" => "Azure::TTS" } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
azure-tts-1.0.0 | lib/azure/tts/speaker.rb |