Reference documentation and code samples for the Cloud Text-to-Speech V1 API class Google::Cloud::TextToSpeech::V1::SynthesisInput.
Contains text input to be synthesized. Either text or ssml must be
supplied. Supplying both or neither returns
[google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. The
input size is limited to 5000 bytes.
The initial support is for en-us, with plans to expand to other locales in
the future. Instant Clone voices aren't supported.
In order to customize the pronunciation of a phrase, there must be an exact
match of the phrase in the input types. If using SSML, the phrase must not
be inside a phoneme tag.
value (::Google::Cloud::TextToSpeech::V1::CustomPronunciations) — Optional. The pronunciation customizations are applied to the input. If
this is set, the input is synthesized using the given pronunciation
customizations.
The initial support is for en-us, with plans to expand to other locales in
the future. Instant Clone voices aren't supported.
In order to customize the pronunciation of a phrase, there must be an exact
match of the phrase in the input types. If using SSML, the phrase must not
be inside a phoneme tag.
The initial support is for en-us, with plans to expand to other locales in
the future. Instant Clone voices aren't supported.
In order to customize the pronunciation of a phrase, there must be an exact
match of the phrase in the input types. If using SSML, the phrase must not
be inside a phoneme tag.
#markup
defmarkup()->::String
Returns
(::String) — Markup for HD voices specifically. This field may not be used with any
other voices.
Note: The following fields are mutually exclusive: markup, text, ssml, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
#markup=
defmarkup=(value)->::String
Parameter
value (::String) — Markup for HD voices specifically. This field may not be used with any
other voices.
Note: The following fields are mutually exclusive: markup, text, ssml, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
Returns
(::String) — Markup for HD voices specifically. This field may not be used with any
other voices.
Note: The following fields are mutually exclusive: markup, text, ssml, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
Note: The following fields are mutually exclusive: multi_speaker_markup, text, markup, ssml. If a field in that set is populated, all other fields in the set will automatically be cleared.
Note: The following fields are mutually exclusive: multi_speaker_markup, text, markup, ssml. If a field in that set is populated, all other fields in the set will automatically be cleared.
Note: The following fields are mutually exclusive: multi_speaker_markup, text, markup, ssml. If a field in that set is populated, all other fields in the set will automatically be cleared.
#ssml
defssml()->::String
Returns
(::String) — The SSML document to be synthesized. The SSML document must be valid
and well-formed. Otherwise the RPC will fail and return
[google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For
more information, see
SSML.
Note: The following fields are mutually exclusive: ssml, text, markup, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
#ssml=
defssml=(value)->::String
Parameter
value (::String) — The SSML document to be synthesized. The SSML document must be valid
and well-formed. Otherwise the RPC will fail and return
[google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For
more information, see
SSML.
Note: The following fields are mutually exclusive: ssml, text, markup, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
Returns
(::String) — The SSML document to be synthesized. The SSML document must be valid
and well-formed. Otherwise the RPC will fail and return
[google.rpc.Code.INVALID_ARGUMENT][google.rpc.Code.INVALID_ARGUMENT]. For
more information, see
SSML.
Note: The following fields are mutually exclusive: ssml, text, markup, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
#text
deftext()->::String
Returns
(::String) — The raw text to be synthesized.
Note: The following fields are mutually exclusive: text, markup, ssml, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
#text=
deftext=(value)->::String
Parameter
value (::String) — The raw text to be synthesized.
Note: The following fields are mutually exclusive: text, markup, ssml, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
Returns
(::String) — The raw text to be synthesized.
Note: The following fields are mutually exclusive: text, markup, ssml, multi_speaker_markup. If a field in that set is populated, all other fields in the set will automatically be cleared.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[],[],null,["# Cloud Text-to-Speech V1 API - Class Google::Cloud::TextToSpeech::V1::SynthesisInput (v1.9.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.9.0 (latest)](/ruby/docs/reference/google-cloud-text_to_speech-v1/latest/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.8.1](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.8.1/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.7.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.7.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.6.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.6.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.5.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.5.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.4.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.4.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.3.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.3.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.2.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.2.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.1.1](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.1.1/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [1.0.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/1.0.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.13.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.13.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.12.2](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.12.2/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.11.1](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.11.1/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.10.1](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.10.1/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.9.1](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.9.1/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.8.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.8.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.7.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.7.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.6.0](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.6.0/Google-Cloud-TextToSpeech-V1-SynthesisInput)\n- [0.5.2](/ruby/docs/reference/google-cloud-text_to_speech-v1/0.5.2/Google-Cloud-TextToSpeech-V1-SynthesisInput) \nReference documentation and code samples for the Cloud Text-to-Speech V1 API class Google::Cloud::TextToSpeech::V1::SynthesisInput.\n\nContains text input to be synthesized. Either `text` or `ssml` must be\nsupplied. Supplying both or neither returns\n\\[google.rpc.Code.INVALID_ARGUMENT\\]\\[google.rpc.Code.INVALID_ARGUMENT\\]. The\ninput size is limited to 5000 bytes. \n\nInherits\n--------\n\n- Object \n\nExtended By\n-----------\n\n- Google::Protobuf::MessageExts::ClassMethods \n\nIncludes\n--------\n\n- Google::Protobuf::MessageExts\n\nMethods\n-------\n\n### #custom_pronunciations\n\n def custom_pronunciations() -\u003e ::Google::Cloud::TextToSpeech::V1::CustomPronunciations\n\n**Returns**\n\n- ([::Google::Cloud::TextToSpeech::V1::CustomPronunciations](./Google-Cloud-TextToSpeech-V1-CustomPronunciations)) --- Optional. The pronunciation customizations are applied to the input. If this is set, the input is synthesized using the given pronunciation customizations.\n\n\n The initial support is for en-us, with plans to expand to other locales in\n the future. Instant Clone voices aren't supported.\n\n In order to customize the pronunciation of a phrase, there must be an exact\n match of the phrase in the input types. If using SSML, the phrase must not\n be inside a phoneme tag.\n\n### #custom_pronunciations=\n\n def custom_pronunciations=(value) -\u003e ::Google::Cloud::TextToSpeech::V1::CustomPronunciations\n\n**Parameter**\n\n- **value** ([::Google::Cloud::TextToSpeech::V1::CustomPronunciations](./Google-Cloud-TextToSpeech-V1-CustomPronunciations)) --- Optional. The pronunciation customizations are applied to the input. If this is set, the input is synthesized using the given pronunciation customizations.\n\n\n The initial support is for en-us, with plans to expand to other locales in\n the future. Instant Clone voices aren't supported.\n\n In order to customize the pronunciation of a phrase, there must be an exact\n match of the phrase in the input types. If using SSML, the phrase must not\nbe inside a phoneme tag. \n**Returns**\n\n- ([::Google::Cloud::TextToSpeech::V1::CustomPronunciations](./Google-Cloud-TextToSpeech-V1-CustomPronunciations)) --- Optional. The pronunciation customizations are applied to the input. If this is set, the input is synthesized using the given pronunciation customizations.\n\n\n The initial support is for en-us, with plans to expand to other locales in\n the future. Instant Clone voices aren't supported.\n\n In order to customize the pronunciation of a phrase, there must be an exact\n match of the phrase in the input types. If using SSML, the phrase must not\n be inside a phoneme tag.\n\n### #markup\n\n def markup() -\u003e ::String\n\n**Returns**\n\n- (::String) --- Markup for HD voices specifically. This field may not be used with any other voices.\n\n Note: The following fields are mutually exclusive: `markup`, `text`, `ssml`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #markup=\n\n def markup=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- Markup for HD voices specifically. This field may not be used with any other voices.\n\n\nNote: The following fields are mutually exclusive: `markup`, `text`, `ssml`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared. \n**Returns**\n\n- (::String) --- Markup for HD voices specifically. This field may not be used with any other voices.\n\n Note: The following fields are mutually exclusive: `markup`, `text`, `ssml`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #multi_speaker_markup\n\n def multi_speaker_markup() -\u003e ::Google::Cloud::TextToSpeech::V1::MultiSpeakerMarkup\n\n**Returns**\n\n- ([::Google::Cloud::TextToSpeech::V1::MultiSpeakerMarkup](./Google-Cloud-TextToSpeech-V1-MultiSpeakerMarkup)) --- The multi-speaker input to be synthesized. Only applicable for multi-speaker synthesis.\n\n\n Note: The following fields are mutually exclusive: `multi_speaker_markup`, `text`, `markup`, `ssml`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #multi_speaker_markup=\n\n def multi_speaker_markup=(value) -\u003e ::Google::Cloud::TextToSpeech::V1::MultiSpeakerMarkup\n\n**Parameter**\n\n- **value** ([::Google::Cloud::TextToSpeech::V1::MultiSpeakerMarkup](./Google-Cloud-TextToSpeech-V1-MultiSpeakerMarkup)) --- The multi-speaker input to be synthesized. Only applicable for multi-speaker synthesis.\n\n\nNote: The following fields are mutually exclusive: `multi_speaker_markup`, `text`, `markup`, `ssml`. If a field in that set is populated, all other fields in the set will automatically be cleared. \n**Returns**\n\n- ([::Google::Cloud::TextToSpeech::V1::MultiSpeakerMarkup](./Google-Cloud-TextToSpeech-V1-MultiSpeakerMarkup)) --- The multi-speaker input to be synthesized. Only applicable for multi-speaker synthesis.\n\n\n Note: The following fields are mutually exclusive: `multi_speaker_markup`, `text`, `markup`, `ssml`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #ssml\n\n def ssml() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The SSML document to be synthesized. The SSML document must be valid and well-formed. Otherwise the RPC will fail and return \\[google.rpc.Code.INVALID_ARGUMENT\\]\\[google.rpc.Code.INVALID_ARGUMENT\\]. For more information, see [SSML](https://cloud.google.com/text-to-speech/docs/ssml).\n\n\n Note: The following fields are mutually exclusive: `ssml`, `text`, `markup`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #ssml=\n\n def ssml=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The SSML document to be synthesized. The SSML document must be valid and well-formed. Otherwise the RPC will fail and return \\[google.rpc.Code.INVALID_ARGUMENT\\]\\[google.rpc.Code.INVALID_ARGUMENT\\]. For more information, see [SSML](https://cloud.google.com/text-to-speech/docs/ssml).\n\n\nNote: The following fields are mutually exclusive: `ssml`, `text`, `markup`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared. \n**Returns**\n\n- (::String) --- The SSML document to be synthesized. The SSML document must be valid and well-formed. Otherwise the RPC will fail and return \\[google.rpc.Code.INVALID_ARGUMENT\\]\\[google.rpc.Code.INVALID_ARGUMENT\\]. For more information, see [SSML](https://cloud.google.com/text-to-speech/docs/ssml).\n\n\n Note: The following fields are mutually exclusive: `ssml`, `text`, `markup`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #text\n\n def text() -\u003e ::String\n\n**Returns**\n\n- (::String) --- The raw text to be synthesized.\n\n Note: The following fields are mutually exclusive: `text`, `markup`, `ssml`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared.\n\n### #text=\n\n def text=(value) -\u003e ::String\n\n**Parameter**\n\n- **value** (::String) --- The raw text to be synthesized.\n\n\nNote: The following fields are mutually exclusive: `text`, `markup`, `ssml`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared. \n**Returns**\n\n- (::String) --- The raw text to be synthesized.\n\n Note: The following fields are mutually exclusive: `text`, `markup`, `ssml`, `multi_speaker_markup`. If a field in that set is populated, all other fields in the set will automatically be cleared."]]