Cloud Text-to-Speech V1beta1 API - Class Google::Cloud::TextToSpeech::V1beta1::TextToSpeech::Client (v0.7.1)

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.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# 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.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#initialize

def initialize() { |config| ... } -> Client

Create a new TextToSpeech client object.

Yields
  • (config) — Configure the TextToSpeech client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# 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.

Overloads
def list_voices(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::ListVoicesResponse
Pass arguments to list_voices via a request object, either of type ListVoicesRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameter
  • 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.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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

#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.

Overloads
def synthesize_speech(request, options = nil) -> ::Google::Cloud::TextToSpeech::V1beta1::SynthesizeSpeechResponse
Pass arguments to synthesize_speech via a request object, either of type SynthesizeSpeechRequest or an equivalent Hash.
Parameters
  • 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
Pass arguments to 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).
Parameters
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

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