Skip to content

Commit f23263b

Browse files
Merge pull request #887 from watson-developer-cloud/codegen/text-to-speech
Ensure accept parameter in synthesize() is not required
2 parents a0f4ef8 + 960c923 commit f23263b

File tree

3 files changed

+6
-70
lines changed

3 files changed

+6
-70
lines changed

text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/TextToSpeech.java

Lines changed: 3 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@
4343
import java.io.InputStream;
4444

4545
/**
46-
* ### Service Overview
47-
* The IBM Text to Speech service provides a Representational State Transfer (REST) Application Programming Interface
48-
* (API) that uses IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of
49-
* languages, dialects, and voices. The service currently synthesizes text from US English, UK English, French, German,
50-
* Italian, Japanese, Spanish, or Brazilian Portuguese into audio spoken in a male or female voice (the service supports
51-
* only a single gender for some languages). The audio is streamed back to the client with minimal delay.
52-
* ### API Overview
5346
* The Text to Speech service consists of the following related endpoints:
5447
* * `/v1/voices` provides information about the voices available for synthesized speech.
5548
* * `/v1/synthesize` synthesizes written text to audio speech.
@@ -61,62 +54,6 @@
6154
* * `/v1/customizations/{customization_id}/words` and `/v1/customizations/{customization_id}/words/{word}` lets users
6255
* manage the words in a custom voice model.
6356
*
64-
*
65-
* **Note about the Try It Out feature:** The `Try it out!` button lets you experiment with the methods of the API by
66-
* making actual cURL calls to the service. The feature is **not** supported for use with the `POST /v1/synthesize`
67-
* method. For examples of calls to this method, see the [Text to Speech API
68-
* reference](http://www.ibm.com/watson/developercloud/text-to-speech/api/v1/).
69-
* ### API Usage
70-
* The following information provides details about using the service to synthesize audio:
71-
* * **Audio formats:** The service supports a number of audio formats (MIME types). For more information about audio
72-
* formats and sampling rates, including links to a number of Internet sites that provide technical and usage details
73-
* about the different formats, see [Specifying an audio
74-
* format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format).
75-
* * **SSML:** Many methods refer to the Speech Synthesis Markup Language (SSML), an XML-based markup language that
76-
* provides annotations of text for speech-synthesis applications; for example, many methods accept or produce
77-
* translations that use an SSML-based phoneme format. See [Using
78-
* SSML](https://console.bluemix.net/docs/services/text-to-speech/SSML.html) and [Using IBM
79-
* SPR](https://console.bluemix.net/docs/services/text-to-speech/SPRs.html).
80-
* * **Word translations:** Many customization methods accept or return sounds-like or phonetic translations for words.
81-
* A phonetic translation is based on the SSML format for representing the phonetic string of a word. Phonetic
82-
* translations can use standard International Phonetic Alphabet (IPA) representation:
83-
*
84-
* <phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>
85-
*
86-
* or the proprietary IBM Symbolic Phonetic Representation (SPR):
87-
*
88-
* <phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>
89-
*
90-
* For more information about customization and about sounds-like and phonetic translations, see [Understanding
91-
* customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html).
92-
* * **GUIDs:** The pronunciation and customization methods accept or return a Globally Unique Identifier (GUID). For
93-
* example, customization IDs (specified with the `customization_id` parameter) and service credentials are GUIDs. GUIDs
94-
* are hexadecimal strings that have the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.
95-
* * **WebSocket interface:** The service also offers a WebSocket interface as an alternative to its HTTP REST interface
96-
* for speech synthesis. The WebSocket interface supports both plain text and SSML input, including the SSML
97-
* <mark> element and word timings. See [The WebSocket
98-
* interface](https://console.bluemix.net/docs/services/text-to-speech/websockets.html).
99-
* * **Authentication:** You authenticate to the service by using your service credentials. You can use your credentials
100-
* to authenticate via a proxy server that resides in IBM Cloud, or you can use your credentials to obtain a token and
101-
* contact the service directly. See [Service credentials for Watson
102-
* services](https://console.bluemix.net/docs/services/watson/getting-started-credentials.html) and [Tokens for
103-
* authentication](https://console.bluemix.net/docs/services/watson/getting-started-tokens.html).
104-
* * **Custom voice model ownership:** In all cases, you must use service credentials created for the instance of the
105-
* service that owns a custom voice model to use the methods described in this documentation with that model. For more
106-
* information, see [Ownership of custom voice
107-
* models](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#customOwner).
108-
* * **Request Logging:** By default, all Watson services log requests and their results. Data is collected only to
109-
* improve the Watson services. If you do not want to share your data, set the header parameter
110-
* `X-Watson-Learning-Opt-Out` to `true` for each request. Data is collected for any request that omits this header. See
111-
* [Controlling request logging for Watson
112-
* services](https://console.bluemix.net/docs/services/watson/getting-started-logging.html).
113-
*
114-
* The service does not log data (words and translations) that are used to build custom language models; your training
115-
* data is never used to improve the service's base models. The service does log data when a custom model is used with a
116-
* synthesize request; you must set the `X-Watson-Learning-Opt-Out` request header to prevent logging for recognition
117-
* requests. For more information, see [Request logging and data
118-
* privacy](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#customLogging).
119-
*
12057
* For more information about the service and its various interfaces, see [About Text to
12158
* Speech](https://console.bluemix.net/docs/services/text-to-speech/index.html).
12259
*
@@ -217,7 +154,9 @@ public ServiceCall<Voices> listVoices() {
217154
public ServiceCall<InputStream> synthesize(SynthesizeOptions synthesizeOptions) {
218155
Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null");
219156
RequestBuilder builder = RequestBuilder.post("/v1/synthesize");
220-
builder.header("Accept", synthesizeOptions.accept());
157+
if (synthesizeOptions.accept() != null) {
158+
builder.header("Accept", synthesizeOptions.accept());
159+
}
221160
if (synthesizeOptions.voice() != null) {
222161
builder.query("voice", synthesizeOptions.voice());
223162
}

text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/SynthesizeOptions.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,11 +119,9 @@ public Builder() {
119119
* Instantiates a new builder with required properties.
120120
*
121121
* @param text the text
122-
* @param accept the accept
123122
*/
124-
public Builder(String text, String accept) {
123+
public Builder(String text) {
125124
this.text = text;
126-
this.accept = accept;
127125
}
128126

129127
/**
@@ -182,7 +180,6 @@ public Builder customizationId(String customizationId) {
182180

183181
private SynthesizeOptions(Builder builder) {
184182
Validator.notNull(builder.text, "text cannot be null");
185-
Validator.notNull(builder.accept, "accept cannot be null");
186183
text = builder.text;
187184
accept = builder.accept;
188185
voice = builder.voice;

text-to-speech/src/main/java/com/ibm/watson/developer_cloud/text_to_speech/v1/model/VoiceModels.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
*/
1313
package com.ibm.watson.developer_cloud.text_to_speech.v1.model;
1414

15-
import com.ibm.watson.developer_cloud.service.model.GenericModel;
16-
1715
import java.util.List;
1816

17+
import com.ibm.watson.developer_cloud.service.model.GenericModel;
18+
1919
/**
2020
* VoiceModels.
2121
*/

0 commit comments

Comments
 (0)