Skip to content

Ensure accept parameter in synthesize() is not required #887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

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 @@ -43,13 +43,6 @@
import java.io.InputStream;

/**
* ### Service Overview
* The IBM Text to Speech service provides a Representational State Transfer (REST) Application Programming Interface
* (API) that uses IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of
* languages, dialects, and voices. The service currently synthesizes text from US English, UK English, French, German,
* Italian, Japanese, Spanish, or Brazilian Portuguese into audio spoken in a male or female voice (the service supports
* only a single gender for some languages). The audio is streamed back to the client with minimal delay.
* ### API Overview
* The Text to Speech service consists of the following related endpoints:
* * `/v1/voices` provides information about the voices available for synthesized speech.
* * `/v1/synthesize` synthesizes written text to audio speech.
Expand All @@ -61,62 +54,6 @@
* * `/v1/customizations/{customization_id}/words` and `/v1/customizations/{customization_id}/words/{word}` lets users
* manage the words in a custom voice model.
*
*
* **Note about the Try It Out feature:** The `Try it out!` button lets you experiment with the methods of the API by
* making actual cURL calls to the service. The feature is **not** supported for use with the `POST /v1/synthesize`
* method. For examples of calls to this method, see the [Text to Speech API
* reference](http://www.ibm.com/watson/developercloud/text-to-speech/api/v1/).
* ### API Usage
* The following information provides details about using the service to synthesize audio:
* * **Audio formats:** The service supports a number of audio formats (MIME types). For more information about audio
* formats and sampling rates, including links to a number of Internet sites that provide technical and usage details
* about the different formats, see [Specifying an audio
* format](https://console.bluemix.net/docs/services/text-to-speech/http.html#format).
* * **SSML:** Many methods refer to the Speech Synthesis Markup Language (SSML), an XML-based markup language that
* provides annotations of text for speech-synthesis applications; for example, many methods accept or produce
* translations that use an SSML-based phoneme format. See [Using
* SSML](https://console.bluemix.net/docs/services/text-to-speech/SSML.html) and [Using IBM
* SPR](https://console.bluemix.net/docs/services/text-to-speech/SPRs.html).
* * **Word translations:** Many customization methods accept or return sounds-like or phonetic translations for words.
* A phonetic translation is based on the SSML format for representing the phonetic string of a word. Phonetic
* translations can use standard International Phonetic Alphabet (IPA) representation:
*
* <phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>
*
* or the proprietary IBM Symbolic Phonetic Representation (SPR):
*
* <phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>
*
* For more information about customization and about sounds-like and phonetic translations, see [Understanding
* customization](https://console.bluemix.net/docs/services/text-to-speech/custom-intro.html).
* * **GUIDs:** The pronunciation and customization methods accept or return a Globally Unique Identifier (GUID). For
* example, customization IDs (specified with the `customization_id` parameter) and service credentials are GUIDs. GUIDs
* are hexadecimal strings that have the format `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`.
* * **WebSocket interface:** The service also offers a WebSocket interface as an alternative to its HTTP REST interface
* for speech synthesis. The WebSocket interface supports both plain text and SSML input, including the SSML
* <mark> element and word timings. See [The WebSocket
* interface](https://console.bluemix.net/docs/services/text-to-speech/websockets.html).
* * **Authentication:** You authenticate to the service by using your service credentials. You can use your credentials
* to authenticate via a proxy server that resides in IBM Cloud, or you can use your credentials to obtain a token and
* contact the service directly. See [Service credentials for Watson
* services](https://console.bluemix.net/docs/services/watson/getting-started-credentials.html) and [Tokens for
* authentication](https://console.bluemix.net/docs/services/watson/getting-started-tokens.html).
* * **Custom voice model ownership:** In all cases, you must use service credentials created for the instance of the
* service that owns a custom voice model to use the methods described in this documentation with that model. For more
* information, see [Ownership of custom voice
* models](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#customOwner).
* * **Request Logging:** By default, all Watson services log requests and their results. Data is collected only to
* improve the Watson services. If you do not want to share your data, set the header parameter
* `X-Watson-Learning-Opt-Out` to `true` for each request. Data is collected for any request that omits this header. See
* [Controlling request logging for Watson
* services](https://console.bluemix.net/docs/services/watson/getting-started-logging.html).
*
* The service does not log data (words and translations) that are used to build custom language models; your training
* data is never used to improve the service's base models. The service does log data when a custom model is used with a
* synthesize request; you must set the `X-Watson-Learning-Opt-Out` request header to prevent logging for recognition
* requests. For more information, see [Request logging and data
* privacy](https://console.bluemix.net/docs/services/text-to-speech/custom-models.html#customLogging).
*
* For more information about the service and its various interfaces, see [About Text to
* Speech](https://console.bluemix.net/docs/services/text-to-speech/index.html).
*
Expand Down Expand Up @@ -217,7 +154,9 @@ public ServiceCall<Voices> listVoices() {
public ServiceCall<InputStream> synthesize(SynthesizeOptions synthesizeOptions) {
Validator.notNull(synthesizeOptions, "synthesizeOptions cannot be null");
RequestBuilder builder = RequestBuilder.post("/v1/synthesize");
builder.header("Accept", synthesizeOptions.accept());
if (synthesizeOptions.accept() != null) {
builder.header("Accept", synthesizeOptions.accept());
}
if (synthesizeOptions.voice() != null) {
builder.query("voice", synthesizeOptions.voice());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,9 @@ public Builder() {
* Instantiates a new builder with required properties.
*
* @param text the text
* @param accept the accept
*/
public Builder(String text, String accept) {
public Builder(String text) {
this.text = text;
this.accept = accept;
}

/**
Expand Down Expand Up @@ -182,7 +180,6 @@ public Builder customizationId(String customizationId) {

private SynthesizeOptions(Builder builder) {
Validator.notNull(builder.text, "text cannot be null");
Validator.notNull(builder.accept, "accept cannot be null");
text = builder.text;
accept = builder.accept;
voice = builder.voice;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
*/
package com.ibm.watson.developer_cloud.text_to_speech.v1.model;

import com.ibm.watson.developer_cloud.service.model.GenericModel;

import java.util.List;

import com.ibm.watson.developer_cloud.service.model.GenericModel;

/**
* VoiceModels.
*/
Expand Down