watson_developer_cloud.text_to_speech_adapter_v1 module¶
-
class
TextToSpeechV1Adapter
(url='https://stream.watsonplatform.net/text-to-speech/api', username=None, password=None, iam_apikey=None, iam_access_token=None, iam_url=None)[source]¶ Bases:
watson_developer_cloud.text_to_speech_v1.TextToSpeechV1
-
synthesize_using_websocket
(text, synthesize_callback, accept=None, voice=None, timings=None, customization_id=None, http_proxy_host=None, http_proxy_port=None, **kwargs)[source]¶ Synthesizes text to spoken audio using web sockets. It supports the use of the SSML <mark> element to identify the location of user-specified markers in the audio. It can also return timing information for all strings of the input text. Note:The service processes one request per connection.
Parameters: text (str) – Provides the text that is to be synthesized. The client can pass plain text or text that is annotated with the Speech Synthesis Markup Language (SSML). For more information, see [Specifying input text](https://console.bluemix.net/docs/services/text-to-speech/http.html#input). SSML input can also include the <mark> element; see [Specifying an SSML mark](https://console.bluemix.net/docs/services/text-to-speech/word-timing.html#mark). The client can pass a maximum of 5 KB of text with the request. :param SynthesizeCallback synthesize_callback: The callback method for the websocket. :param str accept: Specifies the requested format (MIME type) of the audio. For more information, see [Specifying an audio format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format). In addition to the supported specifications, you can use / to specify the default audio format, audio/ogg;codecs=opus. :param str voice: The voice to use for synthesis. :param list[str] timings: Specifies that the service is to return word timing information for all strings of the input text. The service returns the start and end time of each string of the input. Specify words as the lone element of the array to request word timings. Specify an empty array or omit the parameter to receive no word timings. For more information, see [Obtaining word timings](https://console.bluemix.net/docs/services/text-to-speech/word-timing.html#timing). Not supported for Japanese input text. :param str customization_id: Specifies the globally unique identifier (GUID) for a custom voice model that is to be used for the synthesis. A custom voice model is guaranteed to work only if it matches the language of the voice that is used for the synthesis. If you include a customization ID, you must call the method with the service credentials of the custom model’s owner. Omit the parameter to use the specified voice with no customization. For more information, see [Understanding customization] (https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html#customIntro). :param str http_proxy_host: http proxy host name. :param str http_proxy_port: http proxy port. If not set, set to 80. :param dict headers: A dict containing the request headers :return: A dict containing the SpeechRecognitionResults response. :rtype: dict
-