Skip to content

Commit 6ba80ea

Browse files
feat: [google-cloud-texttospeech] Add low latency journey option to proto (#13140)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: Add CustomPronunciationParams for upcoming feature work feat: Add low latency journey option to proto END_COMMIT_OVERRIDE PiperOrigin-RevId: 684229364 Source-Link: googleapis/googleapis@10b8dc3 Source-Link: googleapis/googleapis-gen@deaa9f3 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRleHR0b3NwZWVjaC8uT3dsQm90LnlhbWwiLCJoIjoiZGVhYTlmMzE5ZjFjNmMxOWE5ZDM2ZWEyMzNhZTMwNzU2NmI2MGMwOSJ9 BEGIN_NESTED_COMMIT feat: [google-cloud-texttospeech] Add low latency journey option to proto feat: Add CustomPronunciationParams for upcoming feature work PiperOrigin-RevId: 684207737 Source-Link: googleapis/googleapis@d6f9dbc Source-Link: googleapis/googleapis-gen@42ac4d7 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLXRleHR0b3NwZWVjaC8uT3dsQm90LnlhbWwiLCJoIjoiNDJhYzRkNzViZWMxYjlkZWViYjA2OGZmODQyYzk1YTgxZGE5YjRkMCJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent c5e93d8 commit 6ba80ea

File tree

14 files changed

+303
-7
lines changed

14 files changed

+303
-7
lines changed

packages/google-cloud-texttospeech/google/cloud/texttospeech/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
TextToSpeechLongAudioSynthesizeClient,
3232
)
3333
from google.cloud.texttospeech_v1.types.cloud_tts import (
34+
AdvancedVoiceOptions,
3435
AudioConfig,
3536
AudioEncoding,
37+
CustomPronunciationParams,
38+
CustomPronunciations,
3639
CustomVoiceParams,
3740
ListVoicesRequest,
3841
ListVoicesResponse,
@@ -58,7 +61,10 @@
5861
"TextToSpeechAsyncClient",
5962
"TextToSpeechLongAudioSynthesizeClient",
6063
"TextToSpeechLongAudioSynthesizeAsyncClient",
64+
"AdvancedVoiceOptions",
6165
"AudioConfig",
66+
"CustomPronunciationParams",
67+
"CustomPronunciations",
6268
"CustomVoiceParams",
6369
"ListVoicesRequest",
6470
"ListVoicesResponse",

packages/google-cloud-texttospeech/google/cloud/texttospeech/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.17.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
TextToSpeechLongAudioSynthesizeClient,
2525
)
2626
from .types.cloud_tts import (
27+
AdvancedVoiceOptions,
2728
AudioConfig,
2829
AudioEncoding,
30+
CustomPronunciationParams,
31+
CustomPronunciations,
2932
CustomVoiceParams,
3033
ListVoicesRequest,
3134
ListVoicesResponse,
@@ -49,8 +52,11 @@
4952
__all__ = (
5053
"TextToSpeechAsyncClient",
5154
"TextToSpeechLongAudioSynthesizeAsyncClient",
55+
"AdvancedVoiceOptions",
5256
"AudioConfig",
5357
"AudioEncoding",
58+
"CustomPronunciationParams",
59+
"CustomPronunciations",
5460
"CustomVoiceParams",
5561
"ListVoicesRequest",
5662
"ListVoicesResponse",

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.17.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
# limitations under the License.
1515
#
1616
from .cloud_tts import (
17+
AdvancedVoiceOptions,
1718
AudioConfig,
1819
AudioEncoding,
20+
CustomPronunciationParams,
21+
CustomPronunciations,
1922
CustomVoiceParams,
2023
ListVoicesRequest,
2124
ListVoicesResponse,
@@ -37,7 +40,10 @@
3740
)
3841

3942
__all__ = (
43+
"AdvancedVoiceOptions",
4044
"AudioConfig",
45+
"CustomPronunciationParams",
46+
"CustomPronunciations",
4147
"CustomVoiceParams",
4248
"ListVoicesRequest",
4349
"ListVoicesResponse",

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1/types/cloud_tts.py

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
"ListVoicesRequest",
2828
"ListVoicesResponse",
2929
"Voice",
30+
"AdvancedVoiceOptions",
3031
"SynthesizeSpeechRequest",
32+
"CustomPronunciationParams",
33+
"CustomPronunciations",
3134
"SynthesisInput",
3235
"VoiceSelectionParams",
3336
"AudioConfig",
@@ -182,10 +185,34 @@ class Voice(proto.Message):
182185
)
183186

184187

188+
class AdvancedVoiceOptions(proto.Message):
189+
r"""Used for advanced voice options.
190+
191+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
192+
193+
Attributes:
194+
low_latency_journey_synthesis (bool):
195+
Only for Journey voices. If false, the
196+
synthesis will be context aware and have higher
197+
latency.
198+
199+
This field is a member of `oneof`_ ``_low_latency_journey_synthesis``.
200+
"""
201+
202+
low_latency_journey_synthesis: bool = proto.Field(
203+
proto.BOOL,
204+
number=1,
205+
optional=True,
206+
)
207+
208+
185209
class SynthesizeSpeechRequest(proto.Message):
186210
r"""The top-level message sent by the client for the
187211
``SynthesizeSpeech`` method.
188212
213+
214+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
215+
189216
Attributes:
190217
input (google.cloud.texttospeech_v1.types.SynthesisInput):
191218
Required. The Synthesizer requires either
@@ -196,6 +223,10 @@ class SynthesizeSpeechRequest(proto.Message):
196223
audio_config (google.cloud.texttospeech_v1.types.AudioConfig):
197224
Required. The configuration of the
198225
synthesized audio.
226+
advanced_voice_options (google.cloud.texttospeech_v1.types.AdvancedVoiceOptions):
227+
Advanced voice options.
228+
229+
This field is a member of `oneof`_ ``_advanced_voice_options``.
199230
"""
200231

201232
input: "SynthesisInput" = proto.Field(
@@ -213,6 +244,87 @@ class SynthesizeSpeechRequest(proto.Message):
213244
number=3,
214245
message="AudioConfig",
215246
)
247+
advanced_voice_options: "AdvancedVoiceOptions" = proto.Field(
248+
proto.MESSAGE,
249+
number=8,
250+
optional=True,
251+
message="AdvancedVoiceOptions",
252+
)
253+
254+
255+
class CustomPronunciationParams(proto.Message):
256+
r"""Pronunciation customization for a phrase.
257+
258+
.. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields
259+
260+
Attributes:
261+
phrase (str):
262+
The phrase to which the customization will be
263+
applied. The phrase can be multiple words (in
264+
the case of proper nouns etc), but should not
265+
span to a whole sentence.
266+
267+
This field is a member of `oneof`_ ``_phrase``.
268+
phonetic_encoding (google.cloud.texttospeech_v1.types.CustomPronunciationParams.PhoneticEncoding):
269+
The phonetic encoding of the phrase.
270+
271+
This field is a member of `oneof`_ ``_phonetic_encoding``.
272+
pronunciation (str):
273+
The pronunciation of the phrase. This must be
274+
in the phonetic encoding specified above.
275+
276+
This field is a member of `oneof`_ ``_pronunciation``.
277+
"""
278+
279+
class PhoneticEncoding(proto.Enum):
280+
r"""The phonetic encoding of the phrase.
281+
282+
Values:
283+
PHONETIC_ENCODING_UNSPECIFIED (0):
284+
Not specified.
285+
PHONETIC_ENCODING_IPA (1):
286+
IPA. (e.g. apple -> ˈæpəl )
287+
https://en.wikipedia.org/wiki/International_Phonetic_Alphabet
288+
PHONETIC_ENCODING_X_SAMPA (2):
289+
X-SAMPA (e.g. apple -> "{p@l" )
290+
https://en.wikipedia.org/wiki/X-SAMPA
291+
"""
292+
PHONETIC_ENCODING_UNSPECIFIED = 0
293+
PHONETIC_ENCODING_IPA = 1
294+
PHONETIC_ENCODING_X_SAMPA = 2
295+
296+
phrase: str = proto.Field(
297+
proto.STRING,
298+
number=1,
299+
optional=True,
300+
)
301+
phonetic_encoding: PhoneticEncoding = proto.Field(
302+
proto.ENUM,
303+
number=2,
304+
optional=True,
305+
enum=PhoneticEncoding,
306+
)
307+
pronunciation: str = proto.Field(
308+
proto.STRING,
309+
number=3,
310+
optional=True,
311+
)
312+
313+
314+
class CustomPronunciations(proto.Message):
315+
r"""A collection of pronunciation customizations.
316+
317+
Attributes:
318+
pronunciations (MutableSequence[google.cloud.texttospeech_v1.types.CustomPronunciationParams]):
319+
The pronunciation customizations to be
320+
applied.
321+
"""
322+
323+
pronunciations: MutableSequence["CustomPronunciationParams"] = proto.RepeatedField(
324+
proto.MESSAGE,
325+
number=1,
326+
message="CustomPronunciationParams",
327+
)
216328

217329

218330
class SynthesisInput(proto.Message):
@@ -242,6 +354,22 @@ class SynthesisInput(proto.Message):
242354
`SSML <https://cloud.google.com/text-to-speech/docs/ssml>`__.
243355
244356
This field is a member of `oneof`_ ``input_source``.
357+
custom_pronunciations (google.cloud.texttospeech_v1.types.CustomPronunciations):
358+
Optional. The pronunciation customizations to
359+
be applied to the input. If this is set, the
360+
input will be synthesized using the given
361+
pronunciation customizations.
362+
363+
The initial support will be for EFIGS (English,
364+
French, Italian, German, Spanish) languages, as
365+
provided in VoiceSelectionParams. Journey and
366+
Instant Clone voices are not supported yet.
367+
368+
In order to customize the pronunciation of a
369+
phrase, there must be an exact match of the
370+
phrase in the input types. If using SSML, the
371+
phrase must not be inside a phoneme tag
372+
(entirely or partially).
245373
"""
246374

247375
text: str = proto.Field(
@@ -254,6 +382,11 @@ class SynthesisInput(proto.Message):
254382
number=2,
255383
oneof="input_source",
256384
)
385+
custom_pronunciations: "CustomPronunciations" = proto.Field(
386+
proto.MESSAGE,
387+
number=3,
388+
message="CustomPronunciations",
389+
)
257390

258391

259392
class VoiceSelectionParams(proto.Message):

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@
2424
TextToSpeechLongAudioSynthesizeClient,
2525
)
2626
from .types.cloud_tts import (
27+
AdvancedVoiceOptions,
2728
AudioConfig,
2829
AudioEncoding,
30+
CustomPronunciationParams,
31+
CustomPronunciations,
2932
CustomVoiceParams,
3033
ListVoicesRequest,
3134
ListVoicesResponse,
@@ -50,8 +53,11 @@
5053
__all__ = (
5154
"TextToSpeechAsyncClient",
5255
"TextToSpeechLongAudioSynthesizeAsyncClient",
56+
"AdvancedVoiceOptions",
5357
"AudioConfig",
5458
"AudioEncoding",
59+
"CustomPronunciationParams",
60+
"CustomPronunciations",
5561
"CustomVoiceParams",
5662
"ListVoicesRequest",
5763
"ListVoicesResponse",

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/gapic_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
#
16-
__version__ = "2.17.2" # {x-release-please-version}
16+
__version__ = "0.0.0" # {x-release-please-version}

packages/google-cloud-texttospeech/google/cloud/texttospeech_v1beta1/types/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,11 @@
1414
# limitations under the License.
1515
#
1616
from .cloud_tts import (
17+
AdvancedVoiceOptions,
1718
AudioConfig,
1819
AudioEncoding,
20+
CustomPronunciationParams,
21+
CustomPronunciations,
1922
CustomVoiceParams,
2023
ListVoicesRequest,
2124
ListVoicesResponse,
@@ -38,7 +41,10 @@
3841
)
3942

4043
__all__ = (
44+
"AdvancedVoiceOptions",
4145
"AudioConfig",
46+
"CustomPronunciationParams",
47+
"CustomPronunciations",
4248
"CustomVoiceParams",
4349
"ListVoicesRequest",
4450
"ListVoicesResponse",

0 commit comments

Comments
 (0)