Class: TextToSpeechV1

TextToSpeechV1

new TextToSpeechV1(options)

Watson Text to Speech service

Parameters:
Name Type Description
options Object
Source:

Methods

addWord(params, callback)

Add a word to a custom voice model

Adds a single word and its translation to the specified custom voice model. A custom model can contain no more than 20,000 entries.

An example call could be

 myTextToSpeech.addWord({
     customization_id: '<model-id>',
     word: 'ACLs',
     translation: 'ackles'
   },
   function(err, res) {
     console.log(err, res);
  });
Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
word String
translation String

the phonetic or sounds-like translation for the word. A phonetic translation is based on the SSML format for representing the phonetic string of a word either as an IPA or IBM SPR translation. A sounds-like translation consists of one or more words that, when combined, sound like the word.

callback function
Source:

addWords(params, callback)

Add words to a custom voice model

Adds one or more words and their translations to the specified custom voice model. A custom model can contain no more than 20,000 entries.

An example of params.words could be:

 [
   {"word":"NCAA", "translation":"N C double A"},
   {"word":"iPhone", "translation":"I phone"}
 ]
Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
words Array.<Word>

Array of {word, translation} objects where translation is the phonetic or sounds-like translation for the word. A phonetic translation is based on the SSML format for representing the phonetic string of a word either as an IPA or IBM SPR translation. A sounds-like translation consists of one or more words that, when combined, sound like the word.

callback function
Source:

createCustomization(params, callback)

Creates a new empty custom voice model

Response looks like:

{
  "customization_id": "abc996ea-86ca-482e-b7ec-0f31c34e5ee9"
}
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
name String
language String <optional>
en-US
description String <optional>
callback function
Source:

deleteCustomization(params, callback)

Delete a custom voice model

Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
callback function
Source:

deleteWord(params, callback)

Deletes a single word from the specified custom voice model.

Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
word String
callback function
Source:

getCustomization(params, callback)

Get a custom voice model

Lists all information about the specified custom voice model. In addition to metadata such as the name and description of the voice model, the output includes the words in the model and their translations as defined in the model. Only the owner of a custom voice model can use this method to query information about the model.

Example response:

 {
   "words": [
     {
       "word": "NCAA",
       "translation": "N C double A"
     },
     {
       "word": "iPhone",
       "translation": "I phone"
     }
   ],
   "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
   "created": 1461173032106,
   "language": "en-US",
   "last_modified": 1461173033323,
   "customization_id": "53506a62-6861-41f5-9a44-352047edcf6f",
   "name": "First cURL Test Update",
   "description": "First customization test via cURL update"
 }
Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
callback function
Source:

getCustomizations(paramsopt, callback)

List custom voice models

Lists metadata such as the name and description for all custom voice models that you own for all languages. Specify a language to list the voice models that you own for the specified language only.

Example response:

{
  "customizations": [
    {
      "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
      "language": "en-US",
      "created": 1461173032707,
      "customization_id": "a4df11a9-7cf9-48e8-8319-08fb7c3b1aa8",
      "name": "Second cURL Test",
      "description": "Second customization test via cURL",
      "last_modified": 1461173032707
    },
    {
      "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
      "language": "en-US",
      "created": 1461173032106,
      "customization_id": "53506a62-6861-41f5-9a44-352047edcf6f",
      "name": "First cURL Test Update",
      "description": "First customization test via cURL update",
      "last_modified": 1461173033323
    }
  ]
}
Parameters:
Name Type Attributes Description
params Object <optional>
Properties
Name Type Attributes Description
language String <optional>

optional filter.

callback function
Source:

getWord(params, callback)

Get the translation for a single word from the specified custom model.

Example output:

{
  "translation": "ackles"
}
Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
word String
callback function
Source:

getWords(params, callback)

List words

Lists all of the words and their translations for the specified custom voice model. The output shows the translations as they are defined in the model.

Example response:

 {
    "words": [
       {
          "word": "NCAA",
           "translation": "N C double A"
       },
       {
          "word": "iPhone",
          "translation": "I phone"
       },
       {
          "word": "EEE",
          "translation": "<phoneme alphabet="ibm" ph="tr1Ipxl.1i"></phoneme>"
       },
       {
          "word": "IEEE",
          "translation": "<phoneme alphabet="ibm" ph="1Y.tr1Ipxl.1i"></phoneme>"
       },
       {
          "word": "ACLs",
          "translation": "ackles"
       }
    ]
 }
Parameters:
Name Type Description
params Object
Properties
Name Type Description
customization_id String
callback function
Source:

pronunciation(params)

Returns the phonetic pronunciation for the specified word.

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
text String

a single word

format String <optional>
ipa

Supported formats are ipa, spr for US English, or spr for other languages

voice String <optional>

Defaults to en-US_MichaelVoice unless a customization_id is specified. Do not specify both a voice and a customization_id

customization_id String <optional>

do not specify both a voice and a customization_id

Source:

synthesize(params, callback)

Streaming speech synthesis of the text in a query parameter

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Default Description
text String
voice String <optional>
en-US_MichaelVoice

Call .voices() for a complete list

accept String <optional>
audio/ogg;codecs=opus

Supported formats are audio/ogg;codecs=opus, audio/wav, audio/flac, audio/l16, audio/basic

X-Watson-Learning-Opt-Out Boolean <optional>
customization_id String <optional>
callback function
Source:

updateCustomization(params, callback)

Update voice model

Updates information for the specified custom voice model. You can update the metadata such as the name and description of the voice model. You can also update the words in the model and their translations. A custom model can contain no more than 20,000 entries. Only the owner of a custom voice model can use this method to update the model.

An example of params.words could be:

 [
   {"word":"NCAA", "translation":"N C double A"},
   {"word":"iPhone", "translation":"I phone"}
 ]
Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
customization_id String
name String <optional>
description String <optional>
words Array.<Word>

Array of {word, translation} objects where translation is the phonetic or sounds-like translation for the word. A phonetic translation is based on the SSML format for representing the phonetic string of a word either as an IPA or IBM SPR translation. A sounds-like translation consists of one or more words that, when combined, sound like the word.

callback function
Source:

voice(params)

Retrieves information about the specified voice

Parameters:
Name Type Description
params Object
Properties
Name Type Attributes Description
voice String
customization_id String <optional>
Source:

voices(params, callback)

Retrieves the voices available for speech synthesis

Parameters:
Name Type Description
params Object
callback function
Source: