Reference documentation and code samples for the Cloud Text-to-Speech V1beta1 API class Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.
Client for the TextToSpeech service.
Service that implements Google Cloud Text-to-Speech API.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the TextToSpeech Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all TextToSpeech clients ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the TextToSpeech Client instance.
The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
#initialize
def initialize() { |config| ... } -> Client
Create a new TextToSpeech client object.
- (config) — Configure the TextToSpeech client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.new # Create a client using a custom configuration client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.new do |config| config.timeout = 10.0 end
#list_voices
def list_voices(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse
def list_voices(language_code: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse
Returns a list of Voice supported for synthesis.
def list_voices(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse
list_voices
via a request object, either of type
ListVoicesRequest or an equivalent Hash.
- request (::Google::Cloud::TextToSpeech::V1beta1::ListVoicesRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def list_voices(language_code: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse
list_voices
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
-
language_code (::String) — Optional. Recommended.
BCP-47 language tag.
If not specified, the API will return all supported voices.
If specified, the ListVoices call will only return voices that can be used
to synthesize this language_code. For example, if you specify
"en-NZ"
, all"en-NZ"
voices will be returned. If you specify"no"
, both"no-\*"
(Norwegian) and"nb-\*"
(Norwegian Bokmal) voices will be returned.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/text_to_speech/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::TextToSpeech::V1beta1::ListVoicesRequest.new # Call the list_voices method. result = client.list_voices request # The returned object is of type Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse. p result
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#streaming_synthesize
def streaming_synthesize(request, options = nil) { |response, operation| ... } -> ::Enumerable<::Google::Cloud::TextToSpeech::V1beta1::StreamingSynthesizeResponse>
Performs bidirectional streaming speech synthesis: receive audio while sending text.
- request (::Gapic::StreamInput, ::Enumerable<::Google::Cloud::TextToSpeech::V1beta1::StreamingSynthesizeRequest, ::Hash>) — An enumerable of StreamingSynthesizeRequest instances.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
- (response, operation) — Access the result along with the RPC operation
- response (::Enumerable<::Google::Cloud::TextToSpeech::V1beta1::StreamingSynthesizeResponse>)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/text_to_speech/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.new # Create an input stream. input = Gapic::StreamInput.new # Call the streaming_synthesize method to start streaming. output = client.streaming_synthesize input # Send requests on the stream. For each request object, set fields by # passing keyword arguments. Be sure to close the stream when done. input << Google::Cloud::TextToSpeech::V1beta1::StreamingSynthesizeRequest.new input << Google::Cloud::TextToSpeech::V1beta1::StreamingSynthesizeRequest.new input.close # The returned object is a streamed enumerable yielding elements of type # ::Google::Cloud::TextToSpeech::V1beta1::StreamingSynthesizeResponse output.each do |current_response| p current_response end
#synthesize_speech
def synthesize_speech(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse
def synthesize_speech(input: nil, voice: nil, audio_config: nil, enable_time_pointing: nil, advanced_voice_options: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse
Synthesizes speech synchronously: receive results after all text input has been processed.
def synthesize_speech(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse
synthesize_speech
via a request object, either of type
SynthesizeSpeechRequest or an equivalent Hash.
- request (::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
- options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
def synthesize_speech(input: nil, voice: nil, audio_config: nil, enable_time_pointing: nil, advanced_voice_options: nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse
synthesize_speech
via keyword arguments. Note that at
least one keyword argument is required. To specify no parameters, or to keep all
the default parameter values, pass an empty Hash as a request object (see above).
- input (::Google::Cloud::TextToSpeech::V1beta1::SynthesisInput, ::Hash) — Required. The Synthesizer requires either plain text or SSML as input.
- voice (::Google::Cloud::TextToSpeech::V1beta1::VoiceSelectionParams, ::Hash) — Required. The desired voice of the synthesized audio.
- audio_config (::Google::Cloud::TextToSpeech::V1beta1::AudioConfig, ::Hash) — Required. The configuration of the synthesized audio.
- enable_time_pointing (::Array<::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest::TimepointType>) — Whether and what timepoints are returned in the response.
- advanced_voice_options (::Google::Cloud::TextToSpeech::V1beta1::AdvancedVoiceOptions, ::Hash) — Advanced voice options.
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
Basic example
require "google/cloud/text_to_speech/v1beta1" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechRequest.new # Call the synthesize_speech method. result = client.synthesize_speech request # The returned object is of type Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse. p result
#universe_domain
def universe_domain() -> String
The effective universe domain
- (String)