Reference documentation and code samples for the Cloud Text-to-Speech V1beta1 API class Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::Client.
REST 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::Rest::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 REST 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::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Rest::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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call 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::Rest::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
#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) -> ::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) -> ::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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call 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::Rest::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