Skip to content
This repository was archived by the owner on Nov 29, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,24 @@ async def list_voices(
) -> cloud_tts.ListVoicesResponse:
r"""Returns a list of Voice supported for synthesis.

.. code-block::

from google.cloud import texttospeech_v1

def sample_list_voices():
# Create a client
client = texttospeech_v1.TextToSpeechClient()

# Initialize request argument(s)
request = texttospeech_v1.ListVoicesRequest(
)

# Make the request
response = client.list_voices(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1.types.ListVoicesRequest, dict]):
The request object. The top-level message sent by the
Expand Down Expand Up @@ -281,6 +299,37 @@ async def synthesize_speech(
r"""Synthesizes speech synchronously: receive results
after all text input has been processed.


.. code-block::

from google.cloud import texttospeech_v1

def sample_synthesize_speech():
# Create a client
client = texttospeech_v1.TextToSpeechClient()

# Initialize request argument(s)
input = texttospeech_v1.SynthesisInput()
input.text = "text_value"

voice = texttospeech_v1.VoiceSelectionParams()
voice.language_code = "language_code_value"

audio_config = texttospeech_v1.AudioConfig()
audio_config.audio_encoding = "ALAW"

request = texttospeech_v1.SynthesizeSpeechRequest(
input=input,
voice=voice,
audio_config=audio_config,
)

# Make the request
response = client.synthesize_speech(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1.types.SynthesizeSpeechRequest, dict]):
The request object. The top-level message sent by the
Expand Down
51 changes: 51 additions & 0 deletions google/cloud/texttospeech_v1/services/text_to_speech/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,25 @@ def list_voices(
) -> cloud_tts.ListVoicesResponse:
r"""Returns a list of Voice supported for synthesis.


.. code-block::

from google.cloud import texttospeech_v1

def sample_list_voices():
# Create a client
client = texttospeech_v1.TextToSpeechClient()

# Initialize request argument(s)
request = texttospeech_v1.ListVoicesRequest(
)

# Make the request
response = client.list_voices(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1.types.ListVoicesRequest, dict]):
The request object. The top-level message sent by the
Expand Down Expand Up @@ -466,6 +485,38 @@ def synthesize_speech(
r"""Synthesizes speech synchronously: receive results
after all text input has been processed.



.. code-block::

from google.cloud import texttospeech_v1

def sample_synthesize_speech():
# Create a client
client = texttospeech_v1.TextToSpeechClient()

# Initialize request argument(s)
input = texttospeech_v1.SynthesisInput()
input.text = "text_value"

voice = texttospeech_v1.VoiceSelectionParams()
voice.language_code = "language_code_value"

audio_config = texttospeech_v1.AudioConfig()
audio_config.audio_encoding = "ALAW"

request = texttospeech_v1.SynthesizeSpeechRequest(
input=input,
voice=voice,
audio_config=audio_config,
)

# Make the request
response = client.synthesize_speech(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1.types.SynthesizeSpeechRequest, dict]):
The request object. The top-level message sent by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,24 @@ async def list_voices(
) -> cloud_tts.ListVoicesResponse:
r"""Returns a list of Voice supported for synthesis.

.. code-block::

from google.cloud import texttospeech_v1beta1

def sample_list_voices():
# Create a client
client = texttospeech_v1beta1.TextToSpeechClient()

# Initialize request argument(s)
request = texttospeech_v1beta1.ListVoicesRequest(
)

# Make the request
response = client.list_voices(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1beta1.types.ListVoicesRequest, dict]):
The request object. The top-level message sent by the
Expand Down Expand Up @@ -283,6 +301,37 @@ async def synthesize_speech(
r"""Synthesizes speech synchronously: receive results
after all text input has been processed.


.. code-block::

from google.cloud import texttospeech_v1beta1

def sample_synthesize_speech():
# Create a client
client = texttospeech_v1beta1.TextToSpeechClient()

# Initialize request argument(s)
input = texttospeech_v1beta1.SynthesisInput()
input.text = "text_value"

voice = texttospeech_v1beta1.VoiceSelectionParams()
voice.language_code = "language_code_value"

audio_config = texttospeech_v1beta1.AudioConfig()
audio_config.audio_encoding = "ALAW"

request = texttospeech_v1beta1.SynthesizeSpeechRequest(
input=input,
voice=voice,
audio_config=audio_config,
)

# Make the request
response = client.synthesize_speech(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1beta1.types.SynthesizeSpeechRequest, dict]):
The request object. The top-level message sent by the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,25 @@ def list_voices(
) -> cloud_tts.ListVoicesResponse:
r"""Returns a list of Voice supported for synthesis.


.. code-block::

from google.cloud import texttospeech_v1beta1

def sample_list_voices():
# Create a client
client = texttospeech_v1beta1.TextToSpeechClient()

# Initialize request argument(s)
request = texttospeech_v1beta1.ListVoicesRequest(
)

# Make the request
response = client.list_voices(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1beta1.types.ListVoicesRequest, dict]):
The request object. The top-level message sent by the
Expand Down Expand Up @@ -482,6 +501,38 @@ def synthesize_speech(
r"""Synthesizes speech synchronously: receive results
after all text input has been processed.



.. code-block::

from google.cloud import texttospeech_v1beta1

def sample_synthesize_speech():
# Create a client
client = texttospeech_v1beta1.TextToSpeechClient()

# Initialize request argument(s)
input = texttospeech_v1beta1.SynthesisInput()
input.text = "text_value"

voice = texttospeech_v1beta1.VoiceSelectionParams()
voice.language_code = "language_code_value"

audio_config = texttospeech_v1beta1.AudioConfig()
audio_config.audio_encoding = "ALAW"

request = texttospeech_v1beta1.SynthesizeSpeechRequest(
input=input,
voice=voice,
audio_config=audio_config,
)

# Make the request
response = client.synthesize_speech(request=request)

# Handle the response
print(response)

Args:
request (Union[google.cloud.texttospeech_v1beta1.types.SynthesizeSpeechRequest, dict]):
The request object. The top-level message sent by the
Expand Down
Loading