Reference documentation and code samples for the Cloud Text-to-Speech V1beta1 API class Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client.
Client for the TextToSpeechLongAudioSynthesize service.
Service that implements Google Cloud Text-to-Speech API.
Inherits
- Object
Methods
.configure
def self.configure() { |config| ... } -> Client::Configuration
Configure the TextToSpeechLongAudioSynthesize Client class.
See Configuration for a description of the configuration fields.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all TextToSpeechLongAudioSynthesize clients ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client.configure do |config| config.timeout = 10.0 end
#configure
def configure() { |config| ... } -> Client::Configuration
Configure the TextToSpeechLongAudioSynthesize 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 TextToSpeechLongAudioSynthesize client object.
- (config) — Configure the TextToSpeechLongAudioSynthesize client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client.new # Create a client using a custom configuration client = ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Client.new do |config| config.timeout = 10.0 end
#operations_client
def operations_client() -> ::Google::Cloud::TextToSpeech::V1beta1::TextToSpeechLongAudioSynthesize::Operations
Get the associated client for long-running operations.
#synthesize_long_audio
def synthesize_long_audio(request, options = nil) -> ::Gapic::Operation
def synthesize_long_audio(parent: nil, input: nil, audio_config: nil, output_gcs_uri: nil, voice: nil) -> ::Gapic::Operation
Synthesizes long form text asynchronously.
def synthesize_long_audio(request, options = nil) -> ::Gapic::Operation
synthesize_long_audio
via a request object, either of type
SynthesizeLongAudioRequest or an equivalent Hash.
- request (::Google::Cloud::TextToSpeech::V1beta1::SynthesizeLongAudioRequest, ::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_long_audio(parent: nil, input: nil, audio_config: nil, output_gcs_uri: nil, voice: nil) -> ::Gapic::Operation
synthesize_long_audio
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).
- parent (::String) — The resource states of the request in the form of projects//locations//voices/*.
- input (::Google::Cloud::TextToSpeech::V1beta1::SynthesisInput, ::Hash) — Required. The Synthesizer requires either plain text or SSML as input.
- audio_config (::Google::Cloud::TextToSpeech::V1beta1::AudioConfig, ::Hash) — Required. The configuration of the synthesized audio.
-
output_gcs_uri (::String) — Specifies a Cloud Storage URI for the synthesis results. Must be
specified in the format:
gs://bucket_name/object_name
, and the bucket must already exist. - voice (::Google::Cloud::TextToSpeech::V1beta1::VoiceSelectionParams, ::Hash) — The desired voice of the synthesized audio.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::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::TextToSpeechLongAudioSynthesize::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::TextToSpeech::V1beta1::SynthesizeLongAudioRequest.new # Call the synthesize_long_audio method. result = client.synthesize_long_audio request # The returned object is of type Gapic::Operation. You can use this # object to check the status of an operation, cancel it, or wait # for results. Here is how to block until completion: result.wait_until_done! timeout: 60 if result.response? p result.response else puts "Error!" end