google/cloud/texttospeech_v1beta1/services/text_to_speech/client.py
def synthesize_speech(
        self,
        request: cloud_tts.SynthesizeSpeechRequest = None,
        *,
        input: cloud_tts.SynthesisInput = None,
        voice: cloud_tts.VoiceSelectionParams = None,
        audio_config: cloud_tts.AudioConfig = None,
        retry: retries.Retry = gapic_v1.method.DEFAULT,
        timeout: float = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> cloud_tts.SynthesizeSpeechResponse:
        r"""Synthesizes speech synchronously: receive results
        after all text input has been processed.

        Args:
            request (:class:`~.cloud_tts.SynthesizeSpeechRequest`):
                The request object. The top-level message sent by the
                client for the `SynthesizeSpeech` method.
            input (:class:`~.cloud_tts.SynthesisInput`):
                Required. The Synthesizer requires
                either plain text or SSML as input.
                This corresponds to the ``input`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            voice (:class:`~.cloud_tts.VoiceSelectionParams`):
                Required. The desired voice of the
                synthesized audio.
                This corresponds to the ``voice`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            audio_config (:class:`~.cloud_tts.AudioConfig`):
                Required. The configuration of the
                synthesized audio.
                This corresponds to the ``audio_config`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.

            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            ~.cloud_tts.SynthesizeSpeechResponse:
                The message returned to the client by the
                ``SynthesizeSpeech`` method.

        """
        # Create or coerce a protobuf request object.
        # Sanity check: If we got a request object, we should *not* have
        # gotten any keyword arguments that map to the request.
        if request is not None and any([input, voice, audio_config]):
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )

        request = cloud_tts.SynthesizeSpeechRequest(request)

        # If we have keyword arguments corresponding to fields on the
        # request, apply these.

        if input is not None:
            request.input = input
        if voice is not None:
            request.voice = voice
        if audio_config is not None:
            request.audio_config = audio_config

        # Wrap the RPC method; this adds retry and timeout information,
        # and friendly error handling.
        rpc = gapic_v1.method.wrap_method(
            self._transport.synthesize_speech,
            default_timeout=None,
            client_info=_client_info,
        )

        # Send the request.
        response = rpc(request, retry=retry, timeout=timeout, metadata=metadata)

        # Done; return the response.
        return response
r"""Synthesizes speech synchronously: receive results
        after all text input has been processed.

        Args:
            request (:class:`~.cloud_tts.SynthesizeSpeechRequest`):
                The request object. The top-level message sent by the
                client for the `SynthesizeSpeech` method.
            input (:class:`~.cloud_tts.SynthesisInput`):
                Required. The Synthesizer requires
                either plain text or SSML as input.
                This corresponds to the ``input`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            voice (:class:`~.cloud_tts.VoiceSelectionParams`):
                Required. The desired voice of the
                synthesized audio.
                This corresponds to the ``voice`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            audio_config (:class:`~.cloud_tts.AudioConfig`):
                Required. The configuration of the
                synthesized audio.
                This corresponds to the ``audio_config`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.

            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            ~.cloud_tts.SynthesizeSpeechResponse:
                The message returned to the client by the
                ``SynthesizeSpeech`` method.

        
r"""Synthesizes speech synchronously: receive results
after all text input has been processed.
r " " " Synthesizes speech synchronously : receive results after all text input has been processed .
def synthesize_speech(
        self,
        request: cloud_tts.SynthesizeSpeechRequest = None,
        *,
        input: cloud_tts.SynthesisInput = None,
        voice: cloud_tts.VoiceSelectionParams = None,
        audio_config: cloud_tts.AudioConfig = None,
        retry: retries.Retry = gapic_v1.method.DEFAULT,
        timeout: float = None,
        metadata: Sequence[Tuple[str, str]] = (),
    ) -> cloud_tts.SynthesizeSpeechResponse:
        if request is not None and any([input, voice, audio_config]):
            raise ValueError(
                "If the `request` argument is set, then none of "
                "the individual field arguments should be set."
            )
        request = cloud_tts.SynthesizeSpeechRequest(request)
        if input is not None:
            request.input = input
        if voice is not None:
            request.voice = voice
        if audio_config is not None:
            request.audio_config = audio_config
        rpc = gapic_v1.method.wrap_method(
            self._transport.synthesize_speech,
            default_timeout=None,
            client_info=_client_info,
        )
        response = rpc(request, retry=retry, timeout=timeout, metadata=metadata)
        return response
def synthesize_speech ( self , request : cloud_tts . SynthesizeSpeechRequest = None , * , input : cloud_tts . SynthesisInput = None , voice : cloud_tts . VoiceSelectionParams = None , audio_config : cloud_tts . AudioConfig = None , retry : retries . Retry = gapic_v1 . method . DEFAULT , timeout : float = None , metadata : Sequence [ Tuple [ str , str ] ] = ( ) , ) -> cloud_tts . SynthesizeSpeechResponse : if request is not None and any ( [ input , voice , audio_config ] ) : raise ValueError ( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) request = cloud_tts . SynthesizeSpeechRequest ( request ) if input is not None : request . input = input if voice is not None : request . voice = voice if audio_config is not None : request . audio_config = audio_config rpc = gapic_v1 . method . wrap_method ( self . _transport . synthesize_speech , default_timeout = None , client_info = _client_info , ) response = rpc ( request , retry = retry , timeout = timeout , metadata = metadata ) return response
r"""Synthesizes speech synchronously: receive results
after all text input has been processed.
r " " " Synthesizes speech synchronously : receive results after all text input has been processed .
r"""Synthesizes speech synchronously: receive results
        after all text input has been processed.

        Args:
            request (:class:`~.cloud_tts.SynthesizeSpeechRequest`):
                The request object. The top-level message sent by the
                client for the `SynthesizeSpeech` method.
            input (:class:`~.cloud_tts.SynthesisInput`):
                Required. The Synthesizer requires
                either plain text or SSML as input.
                This corresponds to the ``input`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            voice (:class:`~.cloud_tts.VoiceSelectionParams`):
                Required. The desired voice of the
                synthesized audio.
                This corresponds to the ``voice`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.
            audio_config (:class:`~.cloud_tts.AudioConfig`):
                Required. The configuration of the
                synthesized audio.
                This corresponds to the ``audio_config`` field
                on the ``request`` instance; if ``request`` is provided, this
                should not be set.

            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.
            timeout (float): The timeout for this request.
            metadata (Sequence[Tuple[str, str]]): Strings which should be
                sent along with the request as metadata.

        Returns:
            ~.cloud_tts.SynthesizeSpeechResponse:
                The message returned to the client by the
                ``SynthesizeSpeech`` method.

        """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. # If we have keyword arguments corresponding to fields on the # request, apply these. # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. # Send the request. # Done; return the response.
The message returned to the client by the
``SynthesizeSpeech`` method.
The message returned to the client by the ` ` SynthesizeSpeech ` ` method .
~.cloud_tts.SynthesizeSpeechResponse
self
request
cloud_tts.SynthesizeSpeechRequest
input
cloud_tts.SynthesisInput
voice
cloud_tts.VoiceSelectionParams
audio_config
cloud_tts.AudioConfig
retry
retries.Retry
Designation of what errors, if any,
should be retried.
Designation of what errors if any should be retried .
timeout
float
The timeout for this request.
The timeout for this request .
metadata
Sequence[Tuple[str, str]]
Strings which should be
sent along with the request as metadata.
Strings which should be sent along with the request as metadata .
request (
`~.cloud_tts.SynthesizeSpeechRequest`):
The request object. The top-level message sent by the
client for the `SynthesizeSpeech` method.
` ~ . cloud_tts . SynthesizeSpeechRequest ` ) : The request object . The top - level message sent by the client for the ` SynthesizeSpeech ` method .
input (
`~.cloud_tts.SynthesisInput`):
Required. The Synthesizer requires
either plain text or SSML as input.
This corresponds to the ``input`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
` ~ . cloud_tts . SynthesisInput ` ) : Required . The Synthesizer requires either plain text or SSML as input . This corresponds to the ` ` input ` ` field on the ` ` request ` ` instance ; if ` ` request ` ` is provided this should not be set .
voice (
`~.cloud_tts.VoiceSelectionParams`):
Required. The desired voice of the
synthesized audio.
This corresponds to the ``voice`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
` ~ . cloud_tts . VoiceSelectionParams ` ) : Required . The desired voice of the synthesized audio . This corresponds to the ` ` voice ` ` field on the ` ` request ` ` instance ; if ` ` request ` ` is provided this should not be set .
audio_config (
`~.cloud_tts.AudioConfig`):
Required. The configuration of the
synthesized audio.
This corresponds to the ``audio_config`` field
on the ``request`` instance; if ``request`` is provided, this
should not be set.
` ~ . cloud_tts . AudioConfig ` ) : Required . The configuration of the synthesized audio . This corresponds to the ` ` audio_config ` ` field on the ` ` request ` ` instance ; if ` ` request ` ` is provided this should not be set .