IBM Cloud API Docs

Introduction

The IBM Watson™ Text to Speech service provides APIs that use IBM's speech-synthesis capabilities to synthesize text into natural-sounding speech in a variety of languages, dialects, and voices. The service supports at least one male or female voice, sometimes both, for each language. The audio is streamed back to the client with minimal delay.

For speech synthesis, the service supports a synchronous HTTP Representational State Transfer (REST) interface and a WebSocket interface. Both interfaces support plain text and SSML input. SSML is an XML-based markup language that provides text annotation for speech-synthesis applications. The WebSocket interface also supports the SSML <mark> element and word timings.

The service offers a customization interface that you can use to define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. A phonetic translation is based on the SSML phoneme format for representing a word. You can specify a phonetic translation in standard International Phonetic Alphabet (IPA) representation or in the proprietary IBM Symbolic Phonetic Representation (SPR).

The service also offers a Tune by Example feature that lets you define custom prompts. You can also define speaker models to improve the quality of your custom prompts. The service supports custom prompts only for US English custom models and voices.

This documentation describes Java SDK major version 9. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Node SDK major version 6. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Python SDK major version 5. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Ruby SDK major version 2. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes .NET Standard SDK major version 5. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Go SDK major version 2. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Swift SDK major version 4. For more information about how to update your code from the previous version, see the migration guide.

This documentation describes Unity SDK major version 5. For more information about how to update your code from the previous version, see the migration guide.

The IBM Watson Unity SDK has the following requirements.

  • The SDK requires Unity version 2018.2 or later to support Transport Layer Security (TLS) 1.2.
    • Set the project settings for both the Scripting Runtime Version and the Api Compatibility Level to .NET 4.x Equivalent.
    • For more information, see TLS 1.0 support.
  • The SDK doesn't support the WebGL projects. Change your build settings to any platform except WebGL.

For more information about how to install and configure the SDK and SDK Core, see https://github.com/watson-developer-cloud/unity-sdk.

The code examples on this tab use the client library that is provided for Java.

Maven

<dependency>
  <groupId>com.ibm.watson</groupId>
  <artifactId>ibm-watson</artifactId>
  <version>11.0.0</version>
</dependency>

Gradle

compile 'com.ibm.watson:ibm-watson:11.0.0'

GitHub

The code examples on this tab use the client library that is provided for Node.js.

Installation

npm install ibm-watson@^8.0.0

GitHub

The code examples on this tab use the client library that is provided for Python.

Installation

pip install --upgrade "ibm-watson>=7.0.0"

GitHub

The code examples on this tab use the client library that is provided for Ruby.

Installation

gem install ibm_watson

GitHub

The code examples on this tab use the client library that is provided for Go.

go get -u github.com/watson-developer-cloud/go-sdk/v2@v3.0.0

GitHub

The code examples on this tab use the client library that is provided for Swift.

Cocoapods

pod 'IBMWatsonTextToSpeechV1', '~> 5.0.0'

Carthage

github "watson-developer-cloud/swift-sdk" ~> 5.0.0

Swift Package Manager

.package(url: "https://github.com/watson-developer-cloud/swift-sdk", from: "5.0.0")

GitHub

The code examples on this tab use the client library that is provided for .NET Standard.

Package Manager

Install-Package IBM.Watson.TextToSpeech.v1 -Version 7.0.0

.NET CLI

dotnet add package IBM.Watson.TextToSpeech.v1 --version 7.0.0

PackageReference

<PackageReference Include="IBM.Watson.TextToSpeech.v1" Version="7.0.0" />

GitHub

The code examples on this tab use the client library that is provided for Unity.

GitHub

Endpoint URLs

Identify the base URL for your service instance.

IBM Cloud URLs

The base URLs come from the service instance. To find the URL, view the service credentials by clicking the name of the service in the Resource list. Use the value of the URL. Add the method to form the complete API endpoint for your request.

The following example URL represents a Text to Speech instance that is hosted in Washington DC:

https://api.us-east.text-to-speech.watson.cloud.ibm.com/instances/6bbda3b3-d572-45e1-8c54-22d6ed9e52c2

The following URLs represent the base URLs for Text to Speech. When you call the API, use the URL that corresponds to the location of your service instance.

  • Dallas: https://api.us-south.text-to-speech.watson.cloud.ibm.com
  • Washington DC: https://api.us-east.text-to-speech.watson.cloud.ibm.com
  • Frankfurt: https://api.eu-de.text-to-speech.watson.cloud.ibm.com
  • Sydney: https://api.au-syd.text-to-speech.watson.cloud.ibm.com
  • Tokyo: https://api.jp-tok.text-to-speech.watson.cloud.ibm.com
  • London: https://api.eu-gb.text-to-speech.watson.cloud.ibm.com
  • Seoul: https://api.kr-seo.text-to-speech.watson.cloud.ibm.com

Set the correct service URL by calling the setServiceUrl() method of the service instance.

Set the correct service URL by specifying the serviceUrl parameter when you create the service instance.

Set the correct service URL by calling the set_service_url() method of the service instance.

Set the correct service URL by specifying the service_url property of the service instance.

Set the correct service URL by calling the SetServiceURL() method of the service instance.

Set the correct service URL by setting the serviceURL property of the service instance.

Set the correct service URL by calling the SetServiceUrl() method of the service instance.

Set the correct service URL by calling the SetServiceUrl() method of the service instance.

Dallas API endpoint example for services managed on IBM Cloud

curl -X {request_method} -u "apikey:{apikey}" "https://api.us-south.text-to-speech.watson.cloud.ibm.com/instances/{instance_id}"

Your service instance might not use this URL

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
TextToSpeech textToSpeech = new TextToSpeech(authenticator);
textToSpeech.setServiceUrl("https://api.us-east.text-to-speech.watson.cloud.ibm.com");

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { IamAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: 'https://api.us-east.text-to-speech.watson.cloud.ibm.com',
});

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
text_to_speech = TextToSpeechV1(
    authenticator=authenticator
)

text_to_speech.set_service_url('https://api.us-east.text-to-speech.watson.cloud.ibm.com')

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

require "ibm_watson/authenticators"
require "ibm_watson/text_to_speech_v1"
include IBMWatson

authenticator = Authenticators::IamAuthenticator.new(
  apikey: "{apikey}"
)
text_to_speech = TextToSpeechV1.new(
  authenticator: authenticator
)
text_to_speech.service_url = "https://api.us-east.text-to-speech.watson.cloud.ibm.com"

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

if textToSpeechErr != nil {
  panic(textToSpeechErr)
}

textToSpeech.SetServiceURL("https://api.us-east.text-to-speech.watson.cloud.ibm.com")

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

let authenticator = WatsonIAMAuthenticator(apiKey: "{apikey}")
let textToSpeech = TextToSpeech(authenticator: authenticator)
textToSpeech.serviceURL = "https://api.us-east.text-to-speech.watson.cloud.ibm.com"

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("https://api.us-east.text-to-speech.watson.cloud.ibm.com");

Default URL

https://api.us-south.text-to-speech.watson.cloud.ibm.com

Example for the Washington DC location

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("https://api.us-east.text-to-speech.watson.cloud.ibm.com");

Cloud Pak for Data URLs

For services installed on Cloud Pak for Data, the base URLs come from both the cluster and service instance.

You can find the base URL from the Cloud Pak for Data web client in the details page about the instance. Click the name of the service in your list of instances to see the URL.

Use that URL in your requests to Text to Speech. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the URL by calling the setServiceUrl() method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by specifying the serviceUrl parameter when you create the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by specifying the url parameter when you create the service instance or by calling the set_url() method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by specifying the url parameter when you create the service instance or by calling the url= method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by specifying the URL parameter when you create the service instance or by calling the SetURL= method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by setting the serviceURL property of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by calling the SetEndpoint() method of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Set the correct service URL by setting the Url property of the service instance. For Cloud Pak for Data System, use a hostname that resolves to an IP address in the cluster.

Endpoint example for Cloud Pak for Data

curl -X {request_method} -H "Authorization: Bearer {token}" "https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api"

Endpoint example for Cloud Pak for Data

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
TextToSpeech textToSpeech = new TextToSpeech(authenticator);
textToSpeech.setServiceUrl("https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api");

Endpoint example for Cloud Pak for Data

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new CloudPakForDataAuthenticator({
    username: '{username}',
    password: '{password}',
    url: 'https://{cpd_cluster_host}{:port}',
  }),
  serviceUrl: 'https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api',
});

Endpoint example for Cloud Pak for Data

from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator

authenticator = CloudPakForDataAuthenticator(
    '{username}',
    '{password}',
    'https://{cpd_cluster_host}{:port}'
)

text_to_speech = TextToSpeechV1(
    authenticator=authenticator
)

text_to_speech.set_service_url('https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api')

Endpoint example for Cloud Pak for Data

require "ibm_watson/authenticators"
require "ibm_watson/text_to_speech_v1"
include IBMWatson

authenticator = Authenticators::CLoudPakForDataAuthenticator.new(
  username: "{username}",
  password: "{password}",
  url: "https://{cpd_cluster_host}{:port}"
)
text_to_speech = TextToSpeechV1.new(
  authenticator: authenticator
)
text_to_speech.service_url = "https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api"

Endpoint example for Cloud Pak for Data

textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

if textToSpeechErr != nil {
  panic(textToSpeechErr)
}

textToSpeech.SetServiceURL("https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api")

Endpoint example for Cloud Pak for Data

let authenticator = CloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}")
let textToSpeech = TextToSpeech(authenticator: authenticator)
textToSpeech.serviceURL = "https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api"

Endpoint example for Cloud Pak for Data

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api");

Endpoint example for Cloud Pak for Data

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("https://{cpd_cluster_host}{:port}/text-to-speech/{deployment_id}/instances/{instance_id}/api");

Disabling SSL verification

All Watson services use Secure Sockets Layer (SSL) (or Transport Layer Security (TLS)) for secure connections between the client and server. The connection is verified against the local certificate store to ensure authentication, integrity, and confidentiality.

If you use a self-signed certificate, you need to disable SSL verification to make a successful connection.

Enabling SSL verification is highly recommended. Disabling SSL jeopardizes the security of the connection and data. Disable SSL only if necessary, and take steps to enable SSL as soon as possible.

To disable SSL verification for a curl request, use the --insecure (-k) option with the request.

To disable SSL verification, create an HttpConfigOptions object and set the disableSslVerification property to true. Then, pass the object to the service instance by using the configureClient method.

To disable SSL verification, set the disableSslVerification parameter to true when you create the service instance.

To disable SSL verification, specify True on the set_disable_ssl_verification method for the service instance.

To disable SSL verification, set the disable_ssl_verification parameter to true in the configure_http_client() method for the service instance.

To disable SSL verification, call the DisableSSLVerification method on the service instance.

To disable SSL verification, call the disableSSLVerification() method on the service instance. You cannot disable SSL verification on Linux.

To disable SSL verification, set the DisableSslVerification method to true on the service instance.

To disable SSL verification, set the DisableSslVerification method to true on the service instance.

Example to disable SSL verification with a service managed on IBM Cloud. Replace {apikey} and {url} with your service credentials.

curl -k -X {request_method} -u "apikey:{apikey}" "{url}/{method}"

Example to disable SSL verification with a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
TextToSpeech textToSpeech = new TextToSpeech(authenticator);
textToSpeech.setServiceUrl("{url}");

HttpConfigOptions configOptions = new HttpConfigOptions.Builder()
  .disableSslVerification(true)
  .build();
textToSpeech.configureClient(configOptions);

Example to disable SSL verification with a service managed on IBM Cloud

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { IamAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: '{url}',
  disableSslVerification: true,
});

Example to disable SSL verification with a service managed on IBM Cloud

from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
text_to_speech = TextToSpeechV1(
    authenticator=authenticator
)

text_to_speech.set_service_url('{url}')

text_to_speech.set_disable_ssl_verification(True)

Example to disable SSL verification with a service managed on IBM Cloud

require "ibm_watson/authenticators"
require "ibm_watson/text_to_speech_v1"
include IBMWatson

authenticator = Authenticators::IamAuthenticator.new(
  apikey: "{apikey}"
)
text_to_speech = TextToSpeechV1.new(
  authenticator: authenticator
)
text_to_speech.service_url = "{url}"

text_to_speech.configure_http_client(disable_ssl_verification: true)

Example to disable SSL verification with a service managed on IBM Cloud

textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

if textToSpeechErr != nil {
  panic(textToSpeechErr)
}

textToSpeech.SetServiceURL("{url}")

textToSpeech.DisableSSLVerification()

Example to disable SSL verification with a service managed on IBM Cloud

let authenticator = WatsonIAMAuthenticator(apiKey: "{apikey}")
let textToSpeech = TextToSpeech(authenticator: authenticator)
textToSpeech.serviceURL = "{url}"

textToSpeech.disableSSLVerification()

Example to disable SSL verification with a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.DisableSslVerification(true);

Example to disable SSL verification with a service managed on IBM Cloud

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.DisableSslVerification = true;

Example to disable SSL verification with an installed service

curl -k -X {request_method} -H "Authorization: Bearer {token}" "{url}/v1/{method}"

Example to disable SSL verification with an installed service

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}", "{username}", "{password}");
TextToSpeech textToSpeech = new TextToSpeech(authenticator);
textToSpeech.setServiceUrl("{url}";

HttpConfigOptions configOptions = new HttpConfigOptions.Builder()
  .disableSslVerification(true)
  .build();
textToSpeech.configureClient(configOptions);

Example to disable SSL verification with an installed service

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new CloudPakForDataAuthenticator({
    username: '{username}',
    password: '{password}',
    url: 'https://{cpd_cluster_host}{:port}',
  }),
  serviceUrl: '{url}',
  disableSslVerification: true,
});

Example to disable SSL verification with an installed service

from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator

authenticator = CloudPakForDataAuthenticator(
    '{username}',
    '{password}'
)

text_to_speech = TextToSpeechV1(
    authenticator=authenticator
)

text_to_speech.set_service_url('{url}')

text_to_speech.set_disable_ssl_verification(True)

Example to disable SSL verification with an installed service

require "ibm_watson/authenticators"
require "ibm_watson/text_to_speech_v1"
include IBMWatson

authenticator = Authenticators::CLoudPakForDataAuthenticator.new(
  username: "{username}",
  password: "{password}",
  url: "https://{cpd_cluster_host}{:port}"
)
text_to_speech = TextToSpeechV1.new(
  authenticator: authenticator
)
text_to_speech.service_url = "{url}"

text_to_speech.configure_http_client(disable_ssl_verification: true)

Example to disable SSL verification with an installed service

textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

if textToSpeechErr != nil {
  panic(textToSpeechErr)
}

textToSpeech.SetServiceURL("{url}")

textToSpeech.DisableSSLVerification()

Example to disable SSL verification with an installed service

let authenticator = WatsonCloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}")
let textToSpeech = TextToSpeech(authenticator: authenticator)
textToSpeech.serviceURL = "{url}"

textToSpeech.disableSSLVerification()

Example to disable SSL verification with an installed service

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.DisableSslVerification(true);

Example to disable SSL verification with an installed service

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.DisableSslVerification = true;

Authentication

IBM Cloud services use IBM Cloud Identity and Access Management (IAM) to authenticate. With IBM Cloud Pak for Data, you pass a bearer token.

IBM Cloud

For IBM Cloud instances, you authenticate to the API by using IBM Cloud Identity and Access Management (IAM).

You can pass either a bearer token in an authorization header or an API key. Tokens support authenticated requests without embedding service credentials in every call. API keys use basic authentication. For more information, see Authenticating to Watson services.

  • For testing and development, you can pass an API key directly.
  • For production use, unless you use the Watson SDKs, use an IAM token.

If you pass in an API key, use apikey for the username and the value of the API key as the password. For example, if the API key is f5sAznhrKQyvBFFaZbtF60m5tzLbqWhyALQawBg5TjRI in the service credentials, include the credentials in your call like this:

curl -u "apikey:f5sAznhrKQyvBFFaZbtF60m5tzLbqWhyALQawBg5TjRI"

For IBM Cloud instances, the SDK provides initialization methods for each form of authentication.

  • Use the API key to have the SDK manage the lifecycle of the access token. The SDK requests an access token, ensures that the access token is valid, and refreshes it if necessary.
  • Use the access token to manage the lifecycle yourself. You must periodically refresh the token.

For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.For more information, see IAM authentication with the SDK.

IBM Cloud. Replace {apikey} and {url} with your service credentials.

curl -X {request_method} -u "apikey:{apikey}" "{url}/v1/{method}"

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
TextToSpeech textToSpeech = new TextToSpeech(authenticator);
textToSpeech.setServiceUrl("{url}");

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { IamAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: '{url}',
});

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator

authenticator = IAMAuthenticator('{apikey}')
text_to_speech = TextToSpeechV1(
    authenticator=authenticator
)

text_to_speech.set_service_url('{url}')

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

require "ibm_watson/authenticators"
require "ibm_watson/text_to_speech_v1"
include IBMWatson

authenticator = Authenticators::IamAuthenticator.new(
  apikey: "{apikey}"
)
text_to_speech = TextToSpeechV1.new(
  authenticator: authenticator
)
text_to_speech.service_url = "{url}"

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

import (
  "github.com/IBM/go-sdk-core/core"
  "github.com/watson-developer-cloud/go-sdk/texttospeechv1"
)

func main() {
  authenticator := &core.IamAuthenticator{
    ApiKey: "{apikey}",
  }

  options := &texttospeechv1.TextToSpeechV1Options{
    Authenticator: authenticator,
  }

  textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

  if textToSpeechErr != nil {
    panic(textToSpeechErr)
  }

  textToSpeech.SetServiceURL("{url}")
}

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

let authenticator = WatsonIAMAuthenticator(apiKey: "{apikey}")
let textToSpeech = TextToSpeech(authenticator: authenticator)
textToSpeech.serviceURL = "{url}"

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

IBM Cloud. SDK managing the IAM token. Replace {apikey} and {url}.

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

Cloud Pak for Data

For Cloud Pak for Data, you pass a bearer token in an Authorization header to authenticate to the API. The token is associated with a username.

  • For testing and development, you can use the bearer token that's displayed in the Cloud Pak for Data web client. To find this token, view the details for the service instance by clicking the name of the service in your list of instances. The details also include the service endpoint URL. Don't use this token in production because it does not expire.
  • For production use, create a user in the Cloud Pak for Data web client to use for authentication. Generate a token from that user's credentials with the POST /v1/authorize method.

For more information, see the Get authorization token method of the Cloud Pak for Data API reference.

For Cloud Pak for Data instances, pass either username and password credentials or a bearer token that you generate to authenticate to the API. Username and password credentials use basic authentication. However, the SDK manages the lifecycle of the token. Tokens are temporary security credentials. If you pass a token, you maintain the token lifecycle.

For production use, create a user in the Cloud Pak for Data web client to use for authentication, and decide which authentication mechanism to use.

  • To have the SDK manage the lifecycle of the token, use the username and password for that new user in your calls.
  • To manage the lifecycle of the token yourself, generate a token from that user's credentials. Call the POST /v1/authorize method to generate the token, and then pass the token in an Authorization header in your calls. You can see an example of the method on the Curl tab.

For more information, see the Get authorization token method of the Cloud Pak for Data API reference.

Don't use the bearer token that's displayed in the web client for the instance except during testing and development because that token does not expire.

To find your value for {url}, view the details for the service instance by clicking the name of the service in your list of instances in the Cloud Pak for Data web client.

Cloud Pak for Data. Generating a bearer token.

Replace {cpd_cluster_host} and {port} with the details for the service instance. Replace {username} and {password} with your Cloud Pak for Data credentials.

curl -k -X POST -H "cache-control: no-cache" -H "Content-Type: application/json" -d "{\"username\":\"{username}\",\"password\":\"{password}\"}" "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize"

The response includes a token property.

Authenticating to the API. Replace {token} with your details.

curl -H "Authorization: Bearer {token}" "{url}/v1/{method}"

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {url}, see Endpoint URLs.

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
TextToSpeech textToSpeech = new TextToSpeech(authenticator);
textToSpeech.setServiceUrl("{url}");

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {url}, see Endpoint URLs.

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new CloudPakForDataAuthenticator({
    username: '{username}',
    password: '{password}',
    url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
  }),
  serviceUrl: '{url}',
});

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {url}, see Endpoint URLs.

from ibm_watson import TextToSpeechV1
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator

authenticator = CloudPakForDataAuthenticator(
    '{username}',
    '{password}',
    'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
)

text_to_speech = TextToSpeechV1(
    authenticator=authenticator
)

text_to_speech.set_service_url('{url}')

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {url}, see Endpoint URLs.

require "ibm_watson/authenticators"
require "ibm_watson/text_to_speech_v1"
include IBMWatson

authenticator = Authenticators::CloudPakForDataAuthenticator.new(
  username: "{username}",
  password: "{password}",
  url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize"
)
text_to_speech = TextToSpeechV1.new(
  authenticator: authenticator
)
text_to_speech.service_url = "{url}"

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {url}, see Endpoint URLs.

import (
  "github.com/IBM/go-sdk-core/core"
  "github.com/watson-developer-cloud/go-sdk/texttospeechv1"
)

func main() {
  authenticator := &core.CloudPakForDataAuthenticator{
    URL: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
    Username: "{username}",
    Password: "{password}",
  }

  options := &texttospeechv1.TextToSpeechV1Options{
    Authenticator: authenticator,
  }

  textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

  if textToSpeechErr != nil {
    panic(textToSpeechErr)
  }

  textToSpeech.SetServiceURL("{url}")
}

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {url}, see Endpoint URLs.

let authenticator = WatsonCloudPakForDataAuthenticator(username: "{username}", password: "{password}", url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize")
let textToSpeech = TextToSpeech(authenticator: authenticator)
textToSpeech.serviceURL = "{url}"

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
    username: "{username}",
    password: "{password}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

Cloud Pak for Data. SDK managing the token.

Replace {username} and {password} with your Cloud Pak for Data credentials. For {cpd_cluster_host}, {port}, {release}, and {instance_id}, see Endpoint URLs.

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

Access between services

Your application might use more than one Watson service. You can grant access between services and you can grant access to more than one service for your applications.

For IBM Cloud services, the method to grant access between Watson services varies depending on the type of API key. For more information, see IAM access.

  • To grant access between IBM Cloud services, create an authorization between the services. For more information, see Granting access between services.
  • To grant access to your services by applications without using user credentials, create a service ID, add an API key, and assign access policies. For more information, see Creating and working with service IDs.

When you give a user ID access to multiple services, use an endpoint URL that includes the service instance ID (for example, https://api.us-south.text-to-speech.watson.cloud.ibm.com/instances/6bbda3b3-d572-45e1-8c54-22d6ed9e52c2). You can find the instance ID in two places:

  • By clicking the service instance row in the Resource list. The instance ID is the GUID in the details pane.

  • By clicking the name of the service instance in the list and looking at the credentials URL.

    If you don't see the instance ID in the URL, the credentials predate service IDs. Add new credentials from the Service credentials page and use those credentials.

Because the Cloud Pak for Data bearer token is associated with a username, you can use the token for all CPD Watson services that are associated with the username.

Error handling

Text to Speech uses standard HTTP response codes to indicate whether a method completed successfully. HTTP response codes in the 2xx range indicate success. A response in the 4xx range is some sort of failure, and a response in the 5xx range usually indicates an internal system error that cannot be resolved by the user. Response codes are listed with the method.

ErrorResponse

Name Description
error
string
Description of the problem.
code
integer
HTTP response code.
code_description
string
Response message.
warnings
string
Warnings associated with the error.

The Java SDK generates an exception for any unsuccessful method invocation. All methods that accept an argument can also throw an IllegalArgumentException.

Exception Description
IllegalArgumentException An invalid argument was passed to the method.

When the Java SDK receives an error response from the Text to Speech service, it generates an exception from the com.ibm.watson.developer_cloud.service.exception package. All service exceptions contain the following fields.

Field Description
statusCode The HTTP response code that is returned.
message A message that describes the error.

When the Node SDK receives an error response from the Text to Speech service, it creates an Error object with information that describes the error that occurred. This error object is passed as the first parameter to the callback function for the method. The contents of the error object are as shown in the following table.

Error

Field Description
code The HTTP response code that is returned.
message A message that describes the error.

The Python SDK generates an exception for any unsuccessful method invocation. When the Python SDK receives an error response from the Text to Speech service, it generates an ApiException with the following fields.

Field Description
code The HTTP response code that is returned.
message A message that describes the error.
info A dictionary of additional information about the error.

When the Ruby SDK receives an error response from the Text to Speech service, it generates an ApiException with the following fields.

Field Description
code The HTTP response code that is returned.
message A message that describes the error.
info A dictionary of additional information about the error.

The Go SDK generates an error for any unsuccessful service instantiation and method invocation. You can check for the error immediately. The contents of the error object are as shown in the following table.

Error

Field Description
code The HTTP response code that is returned.
message A message that describes the error.

The Swift SDK returns a WatsonError in the completionHandler any unsuccessful method invocation. This error type is an enum that conforms to LocalizedError and contains an errorDescription property that returns an error message. Some of the WatsonError cases contain associated values that reveal more information about the error.

Field Description
errorDescription A message that describes the error.

When the .NET Standard SDK receives an error response from the Text to Speech service, it generates a ServiceResponseException with the following fields.

Field Description
Message A message that describes the error.
CodeDescription The HTTP response code that is returned.

When the Unity SDK receives an error response from the Text to Speech service, it generates an IBMError with the following fields.

Field Description
Url The URL that generated the error.
StatusCode The HTTP response code returned.
ErrorMessage A message that describes the error.
Response The contents of the response from the server.
ResponseHeaders A dictionary of headers returned by the request.

Example error handling

try {
  // Invoke a method
} catch (NotFoundException e) {
  // Handle Not Found (404) exception
} catch (RequestTooLargeException e) {
  // Handle Request Too Large (413) exception
} catch (ServiceResponseException e) {
  // Base class for all exceptions caused by error responses from the service
  System.out.println("Service returned status code "
    + e.getStatusCode() + ": " + e.getMessage());
}

Example error handling

textToSpeech.method(params)
  .catch(err => {
    console.log('error:', err);
  });

Example error handling

from ibm_watson import ApiException
try:
    # Invoke a method
except ApiException as ex:
    print "Method failed with status code " + str(ex.code) + ": " + ex.message

Example error handling

require "ibm_watson"
begin
  # Invoke a method
rescue IBMWatson::ApiException => ex
  print "Method failed with status code #{ex.code}: #{ex.error}"
end

Example error handling

import "github.com/watson-developer-cloud/go-sdk/texttospeechv1"

// Instantiate a service
textToSpeech, textToSpeechErr := texttospeechv1.NewTextToSpeechV1(options)

// Check for errors
if textToSpeechErr != nil {
  panic(textToSpeechErr)
}

// Call a method
result, _, responseErr := textToSpeech.MethodName(&methodOptions)

// Check for errors
if responseErr != nil {
  panic(responseErr)
}

Example error handling

textToSpeech.method() {
  response, error in

  if let error = error {
    switch error {
    case let .http(statusCode, message, metadata):
      switch statusCode {
      case .some(404):
        // Handle Not Found (404) exception
        print("Not found")
      case .some(413):
        // Handle Request Too Large (413) exception
        print("Payload too large")
      default:
        if let statusCode = statusCode {
          print("Error - code: \(statusCode), \(message ?? "")")
        }
      }
    default:
      print(error.localizedDescription)
    }
    return
  }

  guard let result = response?.result else {
    print(error?.localizedDescription ?? "unknown error")
    return
  }

  print(result)
}

Example error handling

try
{
    // Invoke a method
}
catch(ServiceResponseException e)
{
    Console.WriteLine("Error: " + e.Message);
}
catch (Exception e)
{
    Console.WriteLine("Error: " + e.Message);
}

Example error handling

// Invoke a method
textToSpeech.MethodName(Callback, Parameters);

// Check for errors
private void Callback(DetailedResponse<ExampleResponse> response, IBMError error)
{
    if (error == null)
    {
        Log.Debug("ExampleCallback", "Response received: {0}", response.Response);
    }
    else
    {
        Log.Debug("ExampleCallback", "Error received: {0}, {1}, {3}", error.StatusCode, error.ErrorMessage, error.Response);
    }
}

Data handling

Additional headers

Some Watson services accept special parameters in headers that are passed with the request.

You can pass request header parameters in all requests or in a single request to the service.

To pass a request header, use the --header (-H) option with a curl request.

To pass header parameters with every request, use the setDefaultHeaders method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, use the addHeader method as a modifier on the request before you execute it.

To pass header parameters with every request, specify the headers parameter when you create the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, use the headers method as a modifier on the request before you execute it.

To pass header parameters with every request, specify the set_default_headers method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, include headers as a dict in the request.

To pass header parameters with every request, specify the add_default_headers method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, specify the headers method as a chainable method in the request.

To pass header parameters with every request, specify the SetDefaultHeaders method of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, specify the Headers as a map in the request.

To pass header parameters with every request, add them to the defaultHeaders property of the service object. See Data collection for an example use of this method.

To pass header parameters in a single request, pass the headers parameter to the request method.

To pass header parameters in a single request, use the WithHeader() method as a modifier on the request before you execute it. See Data collection for an example use of this method.

To pass header parameters in a single request, use the WithHeader() method as a modifier on the request before you execute it.

Example header parameter in a request

curl -X {request_method} -H "Request-Header: {header_value}" "{url}/v1/{method}"

Example header parameter in a request

ReturnType returnValue = textToSpeech.methodName(parameters)
  .addHeader("Custom-Header", "{header_value}")
  .execute();

Example header parameter in a request

const parameters = {
  {parameters}
};

textToSpeech.methodName(
  parameters,
  headers: {
    'Custom-Header': '{header_value}'
  })
   .then(result => {
    console.log(response);
  })
  .catch(err => {
    console.log('error:', err);
  });

Example header parameter in a request

response = text_to_speech.methodName(
    parameters,
    headers = {
        'Custom-Header': '{header_value}'
    })

Example header parameter in a request

response = text_to_speech.headers(
  "Custom-Header" => "{header_value}"
).methodName(parameters)

Example header parameter in a request

result, _, responseErr := textToSpeech.MethodName(
  &methodOptions{
    Headers: map[string]string{
      "Accept": "application/json",
    },
  },
)

Example header parameter in a request

let customHeader: [String: String] = ["Custom-Header": "{header_value}"]
textToSpeech.methodName(parameters, headers: customHeader) {
  response, error in
}

Example header parameter in a request for a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.WithHeader("Custom-Header", "header_value");

Example header parameter in a request for an installed service

CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("https://{cpd_cluster_host}{:port}/text-to-speech/{release}/instances/{instance_id}/api");

textToSpeech.WithHeader("Custom-Header", "header_value");

Example header parameter in a request for a service managed on IBM Cloud

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.WithHeader("Custom-Header", "header_value");

Example header parameter in a request for an installed service

var authenticator = new CloudPakForDataAuthenticator(
    url: "https://{cpd_cluster_host}{:port}",
    username: "{username}",
    password: "{password}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("https://{cpd_cluster_host}{:port}/text-to-speech/{release}/instances/{instance_id}/api");

textToSpeech.WithHeader("Custom-Header", "header_value");

Response details

The Text to Speech service might return information to the application in response headers.

To access all response headers that the service returns, include the --include (-i) option with a curl request. To see detailed response data for the request, including request headers, response headers, and extra debugging information, include the --verbose (-v) option with the request.

Example request to access response headers

curl -X {request_method} {authentication_method} --include "{url}/v1/{method}"

To access information in the response headers, use one of the request methods that returns details with the response: executeWithDetails(), enqueueWithDetails(), or rxWithDetails(). These methods return a Response<T> object, where T is the expected response model. Use the getResult() method to access the response object for the method, and use the getHeaders() method to access information in response headers.

Example request to access response headers

Response<ReturnType> response = textToSpeech.methodName(parameters)
  .executeWithDetails();
// Access response from methodName
ReturnType returnValue = response.getResult();
// Access information in response headers
Headers responseHeaders = response.getHeaders();

All response data is available in the Response<T> object that is returned by each method. To access information in the response object, use the following properties.

Property Description
result Returns the response for the service-specific method.
headers Returns the response header information.
status Returns the HTTP status code.

Example request to access response headers

textToSpeech.methodName(parameters)
  .then(response => {
    console.log(response.headers);
  })
  .catch(err => {
    console.log('error:', err);
  });

The return value from all service methods is a DetailedResponse object. To access information in the result object or response headers, use the following methods.

DetailedResponse

Method Description
get_result() Returns the response for the service-specific method.
get_headers() Returns the response header information.
get_status_code() Returns the HTTP status code.

Example request to access response headers

text_to_speech.set_detailed_response(True)
response = text_to_speech.methodName(parameters)
# Access response from methodName
print(json.dumps(response.get_result(), indent=2))
# Access information in response headers
print(response.get_headers())
# Access HTTP response status
print(response.get_status_code())

The return value from all service methods is a DetailedResponse object. To access information in the response object, use the following properties.

DetailedResponse

Property Description
result Returns the response for the service-specific method.
headers Returns the response header information.
status Returns the HTTP status code.

Example request to access response headers

response = text_to_speech.methodName(parameters)
# Access response from methodName
print response.result
# Access information in response headers
print response.headers
# Access HTTP response status
print response.status

The return value from all service methods is a DetailedResponse object. To access information in the response object or response headers, use the following methods.

DetailedResponse

Method Description
GetResult() Returns the response for the service-specific method.
GetHeaders() Returns the response header information.
GetStatusCode() Returns the HTTP status code.

Example request to access response headers

import (
  "github.com/IBM/go-sdk-core/core"
  "github.com/watson-developer-cloud/go-sdk/texttospeechv1"
)
result, response, responseErr := textToSpeech.MethodName(
  &methodOptions{})
// Access result
core.PrettyPrint(response.GetResult(), "Result ")

// Access response headers
core.PrettyPrint(response.GetHeaders(), "Headers ")

// Access status code
core.PrettyPrint(response.GetStatusCode(), "Status Code ")

All response data is available in the WatsonResponse<T> object that is returned in each method's completionHandler.

Example request to access response headers

textToSpeech.methodName(parameters) {
  response, error in

  guard let result = response?.result else {
    print(error?.localizedDescription ?? "unknown error")
    return
  }
  print(result) // The data returned by the service
  print(response?.statusCode)
  print(response?.headers)
}

The response contains fields for response headers, response JSON, and the status code.

DetailedResponse

Property Description
Result Returns the result for the service-specific method.
Response Returns the raw JSON response for the service-specific method.
Headers Returns the response header information.
StatusCode Returns the HTTP status code.

Example request to access response headers

var results = textToSpeech.MethodName(parameters);

var result = results.Result;            //  The result object
var responseHeaders = results.Headers;  //  The response headers
var responseJson = results.Response;    //  The raw response JSON
var statusCode = results.StatusCode;    //  The response status code

The response contains fields for response headers, response JSON, and the status code.

DetailedResponse

Property Description
Result Returns the result for the service-specific method.
Response Returns the raw JSON response for the service-specific method.
Headers Returns the response header information.
StatusCode Returns the HTTP status code.

Example request to access response headers

private void Example()
{
    textToSpeech.MethodName(Callback, Parameters);
}

private void Callback(DetailedResponse<ResponseType> response, IBMError error)
{
    var result = response.Result;                 //  The result object
    var responseHeaders = response.Headers;       //  The response headers
    var responseJson = reresponsesults.Response;  //  The raw response JSON
    var statusCode = response.StatusCode;         //  The response status code
}

Data labels (IBM Cloud)

You can remove data associated with a specific customer if you label the data with a customer ID when you send a request to the service.

  • Use the X-Watson-Metadata header to associate a customer ID with the data. By adding a customer ID to a request, you indicate that it contains data that belongs to that customer.

    Specify a random or generic string for the customer ID. Do not include personal data, such as an email address. Pass the string customer_id={id} as the argument of the header.

    Labeling data is used only by methods that accept customer data.

  • Use the Delete labeled data method to remove data that is associated with a customer ID.

Use this process of labeling and deleting data only when you want to remove the data that is associated with a single customer, not when you want to remove data for multiple customers. For more information about Text to Speech and labeling data, see Information security.

For more information about how to pass headers, see Additional headers.

Data collection (IBM Cloud)

By default, Text to Speech service instances managed on IBM Cloud that are not part of Premium plans collect data about API requests and their results. This data is collected only to improve the services for future users. The collected data is not shared or made public. Data is not collected for services that are part of Premium plans.

To prevent IBM usage of your data for an API request, set the X-Watson-Learning-Opt-Out header parameter to true. You can also disable request logging at the account level. For more information, see Controlling request logging for Watson services.

You must set the header on each request that you do not want IBM to access for general service improvements.

You can set the header by using the setDefaultHeaders method of the service object.

You can set the header by using the headers parameter when you create the service object.

You can set the header by using the set_default_headers method of the service object.

You can set the header by using the add_default_headers method of the service object.

You can set the header by using the SetDefaultHeaders method of the service object.

You can set the header by adding it to the defaultHeaders property of the service object.

You can set the header by using the WithHeader() method of the service object.

Example request with a service managed on IBM Cloud

curl -u "apikey:{apikey}" -H "X-Watson-Learning-Opt-Out: true" "{url}/{method}"

Example request with a service managed on IBM Cloud

Map<String, String> headers = new HashMap<String, String>();
headers.put("X-Watson-Learning-Opt-Out", "true");

textToSpeech.setDefaultHeaders(headers);

Example request with a service managed on IBM Cloud

const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
const { IamAuthenticator } = require('ibm-watson/auth');

const textToSpeech = new TextToSpeechV1({
  authenticator: new IamAuthenticator({
    apikey: '{apikey}',
  }),
  serviceUrl: '{url}',
  headers: {
    'X-Watson-Learning-Opt-Out': 'true'
  }
});

Example request with a service managed on IBM Cloud

text_to_speech.set_default_headers({'x-watson-learning-opt-out': "true"})

Example request with a service managed on IBM Cloud

text_to_speech.add_default_headers(headers: {"x-watson-learning-opt-out" => "true"})

Example request with a service managed on IBM Cloud

import "net/http"

headers := http.Header{}
headers.Add("x-watson-learning-opt-out", "true")
textToSpeech.SetDefaultHeaders(headers)

Example request with a service managed on IBM Cloud

textToSpeech.defaultHeaders["X-Watson-Learning-Opt-Out"] = "true"

Example request with a service managed on IBM Cloud

IamAuthenticator authenticator = new IamAuthenticator(
    apikey: "{apikey}"
    );

TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.WithHeader("X-Watson-Learning-Opt-Out", "true");

Example request with a service managed on IBM Cloud

var authenticator = new IamAuthenticator(
    apikey: "{apikey}"
);

while (!authenticator.CanAuthenticate())
    yield return null;

var textToSpeech = new TextToSpeechService(authenticator);
textToSpeech.SetServiceUrl("{url}");

textToSpeech.WithHeader("X-Watson-Learning-Opt-Out", "true");

Synchronous and asynchronous requests

The Java SDK supports both synchronous (blocking) and asynchronous (non-blocking) execution of service methods. All service methods implement the ServiceCall interface.

  • To call a method synchronously, use the execute method of the ServiceCall interface. You can call the execute method directly from an instance of the service.
  • To call a method asynchronously, use the enqueue method of the ServiceCall interface to receive a callback when the response arrives. The ServiceCallback interface of the method's argument provides onResponse and onFailure methods that you override to handle the callback.

The Ruby SDK supports both synchronous (blocking) and asynchronous (non-blocking) execution of service methods. All service methods implement the Concurrent::Async module. When you use the synchronous or asynchronous methods, an IVar object is returned. You access the DetailedResponse object by calling ivar_object.value.

For more information about the Ivar object, see the IVar class docs.

  • To call a method synchronously, either call the method directly or use the .await chainable method of the Concurrent::Async module.

    Calling a method directly (without .await) returns a DetailedResponse object.

  • To call a method asynchronously, use the .async chainable method of the Concurrent::Async module.

You can call the .await and .async methods directly from an instance of the service.

Example synchronous request

ReturnType returnValue = textToSpeech.method(parameters).execute();

Example asynchronous request

textToSpeech.method(parameters).enqueue(new ServiceCallback<ReturnType>() {
  @Override public void onResponse(ReturnType response) {
    . . .
  }
  @Override public void onFailure(Exception e) {
    . . .
  }
});

Example synchronous request

response = text_to_speech.method_name(parameters)

or

response = text_to_speech.await.method_name(parameters)

Example asynchronous request

response = text_to_speech.async.method_name(parameters)

WebSockets

Synthesize audio (WebSockets)

Synthesizes text to spoken audio over a WebSocket connection. The synthesize method establishes a connection with the service. You then send the text to be synthesized to the service as a JSON text message over the connection. The service returns the audio as a stream of binary data.

The endpoint for the WebSocket API is

wss://api.{location}.text-to-speech.watson.cloud.ibm.com/instances/{instance_id}/v1/synthesize
  • {location} indicates where your application is hosted:

  • {instance_id} indicates the unique identifier of the service instance. For more information how to find the instance ID, see Access between services.

The examples in the documentation abbreviate wss://api.{location}.text-to-speech.watson.cloud.ibm.com/instances/{instance_id} to {ws_url}. So all WebSocket examples call the method as {ws_url}/v1/synthesize.

You can provide a maximum of 5 KB of either plain text or text that is annotated with SSML. With most voices, you can use the SSML <mark> element to request the location of the marker in the audio stream, and you can request word timing information in the form of start and end times for all strings of the input text. The service returns mark and word timing results as text messages over the connection. The <mark> element and word timings are available only with the WebSocket interface, not with the HTTP interface.

See also:

The WebSocket interface cannot be called from curl. Use a client-side scripting language to call the interface. The example request uses JavaScript to invoke the WebSocket synthesize method.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the accept parameter to specify the requested format of the response audio. Specify */* with the parameter to use the default, Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a different value, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • */* - Specifies the default audio format: audio/ogg;codecs=opus.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the accept parameter specify a different format in which you want the service to return the audio.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

URI /v1/synthesize

Request

The client establishes a connection with the service by using the WebSocket constructor to create an instance of a WebSocket connection object. The constructor sets the following basic parameters for the connection and the synthesis.

Parameters of synthesize method

  • Pass a valid access token to authenticate with the service. You must use the access token before it expires.

    • IBM Cloud only. Pass an Identity and Access Management (IAM) access token to authenticate with the service. You pass an IAM access token instead of passing an API key with the call. For more information, see Authenticating to IBM Cloud.

    • IBM Cloud Pak for Data only. Pass an access token as you would with the Authorization header of an HTTP request. For more information, see Authenticating to IBM Cloud Pak for Data.

  • The voice to use for speech synthesis. The default voice is en-US_MichaelV3Voice. For Text to Speech for IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also:

    Allowable values: [de-DE_BirgitV3Voice, de-DE_DieterV3Voice, de-DE_ErikaV3Voice, en-AU_HeidiExpressive, en-AU_JackExpressive, en-GB_CharlotteV3Voice, en-GB_JamesV3Voice, en-GB_KateV3Voice, en-US_AllisonExpressive, en-US_AllisonV3Voice, en-US_EmilyV3Voice, en-US_EmmaExpressive, en-US_HenryV3Voice, en-US_KevinV3Voice, en-US_LisaExpresssive, en-US_LisaV3Voice, en-US_MichaelExpressive, en-US_MichaelV3Voice, en-US_OliviaV3Voice, es-ES_LauraV3Voice, es-ES_EnriqueV3Voice es-LA_SofiaV3Voice, es-US_SofiaV3Voice, fr-CA_LouiseV3Voice, fr-FR_NicolasV3Voice, fr-FR_ReneeV3Voice, it-IT_FrancescaV3Voice, ja-JP_EmiV3Voice, ko-KR_JinV3Voice, ko-KR_SiWooVoice, nl-NL_MerelV3Voice, pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The customization ID (GUID) of a custom model that is to be used for the synthesis. A custom model works only if it matches the language of the indicated voice. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified voice with no customization.

  • Indicates whether IBM can use data that is sent over the connection to improve the service for future users. Specify true to prevent IBM from accessing the logged data. See Data collection.

    Default: false

  • Associates a customer ID with all data that is passed over the connection. The parameter accepts the argument customer_id={id}, where {id} is a random or generic string that is to be associated with the data. URL-encode the argument to the parameter, for example customer_id%3dmy_ID. By default, no customer ID is associated with the data. See Data labels.

  • For German voices, indicates how the service is to spell out strings of individual letters. To indicate the pace of the spelling, specify one of the following values:

    • default - The service reads the characters at the rate at which it synthesizes speech for the request. You can also omit the parameter entirely to achieve the default behavior.

    • singles - The service reads the characters one at a time, with a brief pause between each character.

    • pairs - The service reads the characters two at a time, with a brief pause between each pair.

    • triples - The service reads the characters three at a time, with a brief pause between each triplet.

    The parameter is beta functionality.

    See also: Specifying how strings are spelled out.

    Allowable values: [default, singles, pairs, triples]

    Default: default

  • The percentage change from the default speaking rate of the voice that is used for speech synthesis. Each voice has a default speaking rate that is optimized to represent a normal rate of speech. The parameter accepts an integer that represents the percentage change from the voice's default rate:

    • Specify a signed negative integer to reduce the speaking rate by that percentage. For example, -10 reduces the rate by ten percent.

    • Specify an unsigned or signed positive integer to increase the speaking rate by that percentage. For example, 10 and +10 increase the rate by ten percent.

    • Specify 0 or omit the parameter to get the default speaking rate for the voice.

    The parameter affects the rate for an entire request. It is beta functionality.

    See also: Modifying the speaking rate.

    Default: 0

  • The percentage change from the default speaking pitch of the voice that is used for speech synthesis. Each voice has a default speaking pitch that is optimized to represent a normal tone of voice. The parameter accepts an integer that represents the percentage change from the voice's default tone:

    • Specify a signed negative integer to lower the voice's pitch by that percentage. For example, -5 reduces the tone by five percent.

    • Specify an unsigned or signed positive integer to increase the voice's pitch by that percentage. For example, 5 and +5 increase the tone by five percent.

    • Specify 0 or omit the parameter to get the default speaking pitch for the voice.

    The parameter affects the pitch for an entire request. It is beta functionality.

    See also: Modifying the speaking pitch.

    Default: 0

The client initiates the synthesis by sending a JSON-formatted text message to the service over the connection.

Parameters of WebSocket text messages

  • The text that us to be synthesized. Provide plain text or text that is annotated with SSML. SSML input can include the SSML <mark> element. Pass a maximum of 5 KB of text. For more information, see

  • The requested format (MIME type) of the audio. Specify */* to use the default, Ogg format with the Opus codec (audio/ogg;codecs=opus). For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw, audio/basic, audio/flac, audio/l16, audio/mp3, audio/mpeg, audio/mulaw, audio/ogg, audio/ogg;codecs=opus, audio/ogg;codecs=vorbis, audio/wav, audio/webm, audio/webm;codecs=opus, audio/webm;codecs=vorbis, */*]

  • An array that specifies whether the service is to return word timing information for all strings of the input text. Specify words as the element of the array to request word timing information. The service returns the start and end time of each word of the input. Specify an empty array or omit the parameter to receive no word timing information.

    Not supported for Japanese input text.

Response

Returns the binary audio stream for the input text as an array of bytes in the specified audio format (MIME type).

If the input text includes one or more SSML <mark> elements, the service returns one or more text messages that include one or more Marks objects.

Marks

  • The location of one or more marks in the audio stream. The response includes one or more marks arrays, each with one more arrays as its elements. Each inner array has two elements: the name of the mark (a string) and the time in seconds at which the mark occurs in the audio (a float). For more information, see Specifying an SSML mark.

    An example response for a single mark named here follows:

    {"marks": [
      ["here", 0.501]
    ] }

If the request includes the timings parameter to request word timing information, the service returns one or more text messages that include one or more Timings objects.

Timings

  • Word timing information for strings in the audio stream. The response includes one or more words arrays, each with one of more arrays as its elements. Each inner array consists of three elements: a word from the input text (a string) followed by the start and end time in seconds at which the word occurs in the audio (two floats). For more information, see Requesting word timings for all words.

    An example response for a single word follows:

    {"words": [
      ["Hello", 0.069, 0.165]
    ] }

Response handling

Response handling for the WebSocket interface is different from HTTP response handling. The WebSocket constructor returns an instance of a WebSocket connection object. You assign application-specific calls to the following methods of the object to handle events that are associated with the connection. Each event handler must accept a single argument for an event from the connection. The event that it accepts causes it to execute.

Methods

  • The status of the connection's opening.

  • Response messages from the service, including the results of the synthesis as a binary stream.

  • Errors for the connection or request.
  • The status of the connection's closing.

The connection can produce the following return codes.

Return code

  • The connection closed normally.

  • The connection closed due to a protocol error.

  • The connection closed abnormally.

  • The connection closed because the frame size exceeded the 4 MB limit.

  • The service is terminating the connection because it encountered an unexpected condition that prevents it from fulfilling the request, such as an invalid argument. The return code can also indicate that the input text was too large. The text cannot exceed 5 KB.

If any errors or warnings are associated with the connection, the service sends a JSON response as a text message with one of the following fields.

Connection response

  • An error message that describes the problem. The message is followed by a second message that includes the boolean value true to indicate that the connection is closed, the return code for the error, and a brief message. The connection is closed.

  • Warning messages about invalid or unknown parameters that are included with the request. The warning includes a descriptive message and a list of invalid argument strings. For example, "Unknown arguments: {invalid_arg_1}, {invalid_arg_2}." The connection remains open.

Example request

var access_token = '{access_token}';
var wsURI = '{ws_url}/v1/synthesize'
  + '?access_token=' + access_token
  + '&voice=en-US_AllisonV3Voice';

function onOpen(evt) {
  var message = {
    text: 'Hello world',
    accept: 'audio/ogg;codecs=opus'
  };
  // The service currently accepts a single message per WebSocket connection.
  websocket.send(JSON.stringify(message));
}

var audioParts = [];
var finalAudio;

function onMessage(evt) {
  if (typeof evt.data === 'string') {
    console.log('Received string message: ', evt.data)
  } else {
    console.log('Received ' + evt.data.size + ' binary bytes', evt.data.type);
    audioParts.push(evt.data);
  }
}

function onClose(evt) {
  console.log('WebSocket closed', evt.code, evt.reason);
  finalAudio = new Blob(audioParts, {type: format});
  console.log('final audio: ', finalAudio);
}

function onError(evt) {
  console.log('WebSocket error', evt);
}

var websocket = new WebSocket(wsURI);
websocket.onopen = onOpen;
websocket.onclose = onClose;
websocket.onmessage = onMessage;
websocket.onerror = onError;

Methods

List voices

Lists all voices available for use with the service. The information includes the name, language, gender, and other details about the voice. The ordering of the list of voices can change from call to call; do not rely on an alphabetized or static list of voices. To see information about a specific voice, use the Get a voice.

See also: Listing all voices

Lists all voices available for use with the service. The information includes the name, language, gender, and other details about the voice. The ordering of the list of voices can change from call to call; do not rely on an alphabetized or static list of voices. To see information about a specific voice, use the Get a voice.

See also: Listing all voices.

Lists all voices available for use with the service. The information includes the name, language, gender, and other details about the voice. The ordering of the list of voices can change from call to call; do not rely on an alphabetized or static list of voices. To see information about a specific voice, use the Get a voice.

See also: Listing all voices.

Lists all voices available for use with the service. The information includes the name, language, gender, and other details about the voice. The ordering of the list of voices can change from call to call; do not rely on an alphabetized or static list of voices. To see information about a specific voice, use the Get a voice.

See also: Listing all voices.

Lists all voices available for use with the service. The information includes the name, language, gender, and other details about the voice. The ordering of the list of voices can change from call to call; do not rely on an alphabetized or static list of voices. To see information about a specific voice, use the Get a voice.

See also: Listing all voices.

GET /v1/voices
ListVoices()
ServiceCall<Voices> listVoices()
listVoices(params)
list_voices(
        self,
        **kwargs,
    ) -> DetailedResponse

Request

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/voices"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/voices"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListVoices();
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListVoices();
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    Voices voices = textToSpeech.listVoices().execute().getResult();
    System.out.println(voices);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    Voices voices = textToSpeech.listVoices().execute().getResult();
    System.out.println(voices);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.listVoices()
      .then(voices => {
        console.log(JSON.stringify(voices, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.listVoices()
      .then(voices => {
        console.log(JSON.stringify(voices, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    voices = text_to_speech.list_voices().get_result()
    print(json.dumps(voices, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    voices = text_to_speech.list_voices().get_result()
    print(json.dumps(voices, indent=2))

Response

Information about all available voices.

Information about all available voices.

Information about all available voices.

Information about all available voices.

Information about all available voices.

Status Code

  • OK. The request succeeded.

  • Not Acceptable. The request specified an Accept header with an incompatible content type.

  • Unsupported Media Type. The request specified an unacceptable media type.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "voices": [
        {
          "name": "es-LA_SofiaV3Voice",
          "language": "es-LA",
          "customizable": true,
          "gender": "female",
          "url": "{url}/v1/voices/es-LA_SofiaV3Voice",
          "supported_features": {
            "voice_transformation": false,
            "custom_pronunciation": true
          },
          "description": "Sofia: Latin American Spanish (español latinoamericano) female voice."
        },
        {
          "name": "pt-BR_IsabelaV3Voice",
          "language": "pt-BR",
          "customizable": true,
          "gender": "female",
          "url": "{url}/v1/voices/pt-BR_IsabelaV3Voice",
          "supported_features": {
            "voice_transformation": false,
            "custom_pronunciation": true
          },
          "description": "Isabela: Brazilian Portuguese (português brasileiro) female voice."
        },
        {
          "name": "en-GB_KateV3Voice",
          "language": "en-GB",
          "customizable": true,
          "gender": "female",
          "url": "{url}/v1/voices/en-GB_KateV3Voice",
          "supported_features": {
            "voice_transformation": false,
            "custom_pronunciation": true
          },
          "description": "Kate: British English female voice."
        }
      ]
    }
  • {
      "voices": [
        {
          "name": "es-LA_SofiaV3Voice",
          "language": "es-LA",
          "customizable": true,
          "gender": "female",
          "url": "{url}/v1/voices/es-LA_SofiaV3Voice",
          "supported_features": {
            "voice_transformation": false,
            "custom_pronunciation": true
          },
          "description": "Sofia: Latin American Spanish (español latinoamericano) female voice."
        },
        {
          "name": "pt-BR_IsabelaV3Voice",
          "language": "pt-BR",
          "customizable": true,
          "gender": "female",
          "url": "{url}/v1/voices/pt-BR_IsabelaV3Voice",
          "supported_features": {
            "voice_transformation": false,
            "custom_pronunciation": true
          },
          "description": "Isabela: Brazilian Portuguese (português brasileiro) female voice."
        },
        {
          "name": "en-GB_KateV3Voice",
          "language": "en-GB",
          "customizable": true,
          "gender": "female",
          "url": "{url}/v1/voices/en-GB_KateV3Voice",
          "supported_features": {
            "voice_transformation": false,
            "custom_pronunciation": true
          },
          "description": "Kate: British English female voice."
        }
      ]
    }

Get a voice

Gets information about the specified voice. The information includes the name, language, gender, and other details about the voice. Specify a customization ID to obtain information for a custom model that is defined for the language of the specified voice. To list information about all available voices, use the List voices method.

See also: Listing a specific voice.

Gets information about the specified voice. The information includes the name, language, gender, and other details about the voice. Specify a customization ID to obtain information for a custom model that is defined for the language of the specified voice. To list information about all available voices, use the List voices method.

See also: Listing a specific voice.

Gets information about the specified voice. The information includes the name, language, gender, and other details about the voice. Specify a customization ID to obtain information for a custom model that is defined for the language of the specified voice. To list information about all available voices, use the List voices method.

See also: Listing a specific voice.

Gets information about the specified voice. The information includes the name, language, gender, and other details about the voice. Specify a customization ID to obtain information for a custom model that is defined for the language of the specified voice. To list information about all available voices, use the List voices method.

See also: Listing a specific voice.

Gets information about the specified voice. The information includes the name, language, gender, and other details about the voice. Specify a customization ID to obtain information for a custom model that is defined for the language of the specified voice. To list information about all available voices, use the List voices method.

See also: Listing a specific voice.

GET /v1/voices/{voice}
GetVoice(string voice, string customizationId = null)
ServiceCall<Voice> getVoice(GetVoiceOptions getVoiceOptions)
getVoice(params)
get_voice(
        self,
        voice: str,
        *,
        customization_id: str = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the GetVoiceOptions.Builder to create a GetVoiceOptions object that contains the parameter values for the getVoice method.

Path Parameters

  • The voice for which information is to be returned.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

Query Parameters

  • The customization ID (GUID) of a custom model for which information is to be returned. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see information about the specified voice with no customization.

parameters

  • The voice for which information is to be returned.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

  • The customization ID (GUID) of a custom model for which information is to be returned. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see information about the specified voice with no customization.

The getVoice options.

parameters

  • The voice for which information is to be returned.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

  • The customization ID (GUID) of a custom model for which information is to be returned. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see information about the specified voice with no customization.

parameters

  • The voice for which information is to be returned.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

  • The customization ID (GUID) of a custom model for which information is to be returned. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see information about the specified voice with no customization.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/voices/en-US_AllisonV3Voice"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/voices/en-US_AllisonV3Voice"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetVoice("en-US_AllisonV3Voice");
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetVoice("en-US_AllisonV3Voice");
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetVoiceOptions getVoiceOptions = new GetVoiceOptions.Builder()
      .voice("en-US_AllisonV3Voice")
      .build();
    
    Voice voice = textToSpeech.getVoice(getVoiceOptions).execute().getResult();
    System.out.println(voice);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetVoiceOptions getVoiceOptions = new GetVoiceOptions.Builder()
      .voice("en-US_AllisonV3Voice")
      .build();
    
    Voice voice = textToSpeech.getVoice(getVoiceOptions).execute().getResult();
    System.out.println(voice);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const getVoiceParams = {
      voice: 'en-US_AllisonV3Voice',
    };
    
    textToSpeech.getVoice(getVoiceParams)
      .then(voice => {
        console.log(JSON.stringify(voice, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const getVoiceParams = {
      voice: 'en-US_AllisonV3Voice',
    };
    
    textToSpeech.getVoice(getVoiceParams)
      .then(voice => {
        console.log(JSON.stringify(voice, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    voice = text_to_speech.get_voice('en-US_AllisonV3Voice').get_result()
    print(json.dumps(voice, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    voice = text_to_speech.get_voice('en-US_AllisonV3Voice').get_result()
    print(json.dumps(voice, indent=2))

Response

Information about an available voice.

Information about an available voice.

Information about an available voice.

Information about an available voice.

Information about an available voice.

Status Code

  • OK. The request succeeded.

  • Not Modified. The requested resource has not been modified since the time specified by the If-Modified-Since header, as documented in the HTTP specification.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'customization_id'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ({id}) for user
  • Not Acceptable. The request specified an Accept header with an incompatible content type.

  • Unsupported Media Type. The request specified an unacceptable media type.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "url": "{url}/v1/voices/en-US_AllisonV3Voice",
      "name": "en-US_AllisonV3Voice",
      "language": "en-US",
      "customizable": true,
      "gender": "female",
      "supported_features": {
        "voice_transformation": false,
        "custom_pronunciation": true
      },
      "description": "Allison: American English female voice."
    }
  • {
      "url": "{url}/v1/voices/en-US_AllisonV3Voice",
      "name": "en-US_AllisonV3Voice",
      "language": "en-US",
      "customizable": true,
      "gender": "female",
      "supported_features": {
        "voice_transformation": false,
        "custom_pronunciation": true
      },
      "description": "Allison: American English female voice."
    }

Synthesize audio (GET)

Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.

The method accepts a maximum of 8 KB of input, which includes the input text and the URL and headers. The 8 KB limit includes any SSML tags that you specify. The service returns the synthesized audio stream as an array of bytes.

See also: The HTTP interface.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the Accept header or the accept parameter to specify the requested format of the response audio. If you omit an audio format altogether, the service returns the audio in Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a value other than one of these, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the Accept request header or the accept query parameter specify a different format in which you want the service to return the audio.

Warning messages

If a request includes invalid query parameters, the service returns a Warnings response header that provides messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a message such as "Unknown arguments:" or "Unknown url query arguments:" followed by a list of the form "{invalid_arg_1}, {invalid_arg_2}." The request succeeds despite the warnings.

GET /v1/synthesize

Request

Custom Headers

  • The requested format (MIME type) of the audio. You can use the Accept header or the accept parameter to specify the audio format. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

Query Parameters

  • The text to synthesize. Specify either plain text or a subset of SSML. SSML is an XML-based markup language that provides text annotation for speech-synthesis applications. You must URL-encode the input text. Pass a maximum of 8 KB of input, which includes the input text and the URL and headers. For more information, see

  • The requested format (MIME type) of the audio. You can use the accept parameter or the Accept header to specify the audio format. URL-encode the argument to the accept parameter; for example, audio/mulaw;rate=8000 becomes audio%2Fmulaw%3Brate%3D8000. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

    Default: audio/ogg;codecs=opus

  • The voice to use for speech synthesis. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also:

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The customization ID (GUID) of a custom model to use for the synthesis. If a custom model is specified, it works only if it matches the language of the indicated voice. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified voice with no customization.

  • For German voices, indicates how the service is to spell out strings of individual letters. To indicate the pace of the spelling, specify one of the following values:

    • default - The service reads the characters at the rate at which it synthesizes speech for the request. You can also omit the parameter entirely to achieve the default behavior.
    • singles - The service reads the characters one at a time, with a brief pause between each character.
    • pairs - The service reads the characters two at a time, with a brief pause between each pair.
    • triples - The service reads the characters three at a time, with a brief pause between each triplet.

    For more information, see Specifying how strings are spelled out.

    Allowable values: [default,singles,pairs,triples]

    Default: default

  • The percentage change from the default speaking rate of the voice that is used for speech synthesis. Each voice has a default speaking rate that is optimized to represent a normal rate of speech. The parameter accepts an integer that represents the percentage change from the voice's default rate:

    • Specify a signed negative integer to reduce the speaking rate by that percentage. For example, -10 reduces the rate by ten percent.
    • Specify an unsigned or signed positive integer to increase the speaking rate by that percentage. For example, 10 and +10 increase the rate by ten percent.
    • Specify 0 or omit the parameter to get the default speaking rate for the voice.

    The parameter affects the rate for an entire request.

    For more information, see Modifying the speaking rate.

    Default: 0

  • The percentage change from the default speaking pitch of the voice that is used for speech synthesis. Each voice has a default speaking pitch that is optimized to represent a normal tone of voice. The parameter accepts an integer that represents the percentage change from the voice's default tone:

    • Specify a signed negative integer to lower the voice's pitch by that percentage. For example, -5 reduces the tone by five percent.
    • Specify an unsigned or signed positive integer to increase the voice's pitch by that percentage. For example, 5 and +5 increase the tone by five percent.
    • Specify 0 or omit the parameter to get the default speaking pitch for the voice.

    The parameter affects the pitch for an entire request.

    For more information, see Modifying the speaking pitch.

    Default: 0

  • curl -X GET -u "apikey:{apikey}" --output hello_world.wav "{url}/v1/synthesize?accept=audio%2Fwav&text=Hello%20world&voice=en-US_AllisonV3Voice"

    Download sample audio output file hello_world.wav

  • curl -X GET --header "Authorization: Bearer {token}" --output hello_world.wav "{url}/v1/synthesize?accept=audio%2Fwav&text=Hello%20world&voice=en-US_AllisonV3Voice"

    Download sample audio output file hello_world.wav

Response

A binary file that contains the audio of the response.

Status Code

  • OK. The request succeeded.

  • Not Modified. The requested resource has not been modified since the time specified by the If-Modified-Since header, as documented in the HTTP specification.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid. Examples of specific messages include

    • prompt_id '{prompt_id}' not found in custom model '{customization_id}' if you attempt to use a nonexistent or deleted custom prompt.
    • <express-as> is not supported in the current voice if you attempt to use the <express-as> element with a voice that is not one of the expressive neural voices or if you specify an illegal value for the style attribute of the element.
    • Tag <express-as> is missing required attribute->type if you omit the style attribute from the <express-as> element.
    • Emphasis level {level} is not supported if you specify an illegal value for the level attribute of the <emphasis> element.

    If the request fails SSML validation, the description of the error explains the failure. For example, <prosody> with attribute volume is not supported in the current voice. For more information, see SSML validation.

  • Not Found. The specified voice does not exist or, for IBM Cloud Pak for Data, the voice parameter was not specified but the default voice is not installed. The message is Model '{voice}' not found.

  • Not Acceptable. The request specified an incompatible content type or failed to specify a required sampling rate.

  • Unsupported Media Type. The request specified an unacceptable media type.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

Synthesize audio

Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service returns the synthesized audio stream as an array of bytes.

See also: The HTTP interface.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the Accept header or the accept parameter to specify the requested format of the response audio. If you omit an audio format altogether, the service returns the audio in Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a value other than one of these, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the Accept request header or the accept query parameter specify a different format in which you want the service to return the audio.

Warning messages

If a request includes invalid query parameters, the service returns a Warnings response header that provides messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a message such as "Unknown arguments:" or "Unknown url query arguments:" followed by a list of the form "{invalid_arg_1}, {invalid_arg_2}." The request succeeds despite the warnings.

Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service returns the synthesized audio stream as an array of bytes.

See also: The HTTP interface.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the Accept header or the accept parameter to specify the requested format of the response audio. If you omit an audio format altogether, the service returns the audio in Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a value other than one of these, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the Accept request header or the accept query parameter specify a different format in which you want the service to return the audio.

Warning messages

If a request includes invalid query parameters, the service returns a Warnings response header that provides messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a message such as "Unknown arguments:" or "Unknown url query arguments:" followed by a list of the form "{invalid_arg_1}, {invalid_arg_2}." The request succeeds despite the warnings.

Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service returns the synthesized audio stream as an array of bytes.

See also: The HTTP interface.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the Accept header or the accept parameter to specify the requested format of the response audio. If you omit an audio format altogether, the service returns the audio in Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a value other than one of these, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the Accept request header or the accept query parameter specify a different format in which you want the service to return the audio.

Warning messages

If a request includes invalid query parameters, the service returns a Warnings response header that provides messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a message such as "Unknown arguments:" or "Unknown url query arguments:" followed by a list of the form "{invalid_arg_1}, {invalid_arg_2}." The request succeeds despite the warnings.

Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service returns the synthesized audio stream as an array of bytes.

See also: The HTTP interface.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the Accept header or the accept parameter to specify the requested format of the response audio. If you omit an audio format altogether, the service returns the audio in Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a value other than one of these, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the Accept request header or the accept query parameter specify a different format in which you want the service to return the audio.

Warning messages

If a request includes invalid query parameters, the service returns a Warnings response header that provides messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a message such as "Unknown arguments:" or "Unknown url query arguments:" followed by a list of the form "{invalid_arg_1}, {invalid_arg_2}." The request succeeds despite the warnings.

Synthesizes text to audio that is spoken in the specified voice. The service bases its understanding of the language for the input text on the specified voice. Use a voice that matches the language of the input text.

The method accepts a maximum of 5 KB of input text in the body of the request, and 8 KB for the URL and headers. The 5 KB limit includes any SSML tags that you specify. The service returns the synthesized audio stream as an array of bytes.

See also: The HTTP interface.

Audio formats (accept types)

The service can return audio in the following formats (MIME types).

  • Where indicated, you can optionally specify the sampling rate (rate) of the audio. You must specify a sampling rate for the audio/alaw, audio/l16, and audio/mulaw formats. A specified sampling rate must lie in the range of 8 kHz to 192 kHz. Some formats restrict the sampling rate to certain values, as noted.
  • For the audio/l16 format, you can optionally specify the endianness (endianness) of the audio: endianness=big-endian or endianness=little-endian.

Use the Accept header or the accept parameter to specify the requested format of the response audio. If you omit an audio format altogether, the service returns the audio in Ogg format with the Opus codec (audio/ogg;codecs=opus). The service always returns single-channel audio.

  • audio/alaw - You must specify the rate of the audio.
  • audio/basic - The service returns audio with a sampling rate of 8000 Hz.
  • audio/flac - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/l16 - You must specify the rate of the audio. You can optionally specify the endianness of the audio. The default endianness is little-endian.
  • audio/mp3 - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mpeg - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/mulaw - You must specify the rate of the audio.
  • audio/ogg - The service returns the audio in the vorbis codec. You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/ogg;codecs=opus - You can optionally specify the rate of the audio. Only the following values are valid sampling rates: 48000, 24000, 16000, 12000, or 8000. If you specify a value other than one of these, the service returns an error. The default sampling rate is 48,000 Hz.
  • audio/ogg;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/wav - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.
  • audio/webm - The service returns the audio in the opus codec. The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=opus - The service returns audio with a sampling rate of 48,000 Hz.
  • audio/webm;codecs=vorbis - You can optionally specify the rate of the audio. The default sampling rate is 22,050 Hz.

For more information about specifying an audio format, including additional details about some of the formats, see Using audio formats.

Note: By default, the service returns audio in the Ogg audio format with the Opus codec (audio/ogg;codecs=opus). However, the Ogg audio format is not supported with the Safari browser. If you are using the service with the Safari browser, you must use the Accept request header or the accept query parameter specify a different format in which you want the service to return the audio.

Warning messages

If a request includes invalid query parameters, the service returns a Warnings response header that provides messages about the invalid parameters. The warning includes a descriptive message and a list of invalid argument strings. For example, a message such as "Unknown arguments:" or "Unknown url query arguments:" followed by a list of the form "{invalid_arg_1}, {invalid_arg_2}." The request succeeds despite the warnings.

POST /v1/synthesize
Synthesize(string text, string accept = null, string voice = null, string customizationId = null, string spellOutMode = null, long? ratePercentage = null, long? pitchPercentage = null)
ServiceCall<InputStream> synthesize(SynthesizeOptions synthesizeOptions)
synthesize(params)
synthesize(
        self,
        text: str,
        *,
        accept: str = None,
        voice: str = None,
        customization_id: str = None,
        spell_out_mode: str = None,
        rate_percentage: int = None,
        pitch_percentage: int = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the SynthesizeOptions.Builder to create a SynthesizeOptions object that contains the parameter values for the synthesize method.

Custom Headers

  • The type of the input.

    Allowable values: [application/json]

  • The requested format (MIME type) of the audio. You can use the Accept header or the accept parameter to specify the audio format. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

Query Parameters

  • The requested format (MIME type) of the audio. You can use the accept parameter or the Accept header to specify the audio format. URL-encode the argument to the accept parameter; for example, audio/mulaw;rate=8000 becomes audio%2Fmulaw%3Brate%3D8000. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

    Default: audio/ogg;codecs=opus

  • The voice to use for speech synthesis. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also:

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The customization ID (GUID) of a custom model to use for the synthesis. If a custom model is specified, it works only if it matches the language of the indicated voice. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified voice with no customization.

  • For German voices, indicates how the service is to spell out strings of individual letters. To indicate the pace of the spelling, specify one of the following values:

    • default - The service reads the characters at the rate at which it synthesizes speech for the request. You can also omit the parameter entirely to achieve the default behavior.
    • singles - The service reads the characters one at a time, with a brief pause between each character.
    • pairs - The service reads the characters two at a time, with a brief pause between each pair.
    • triples - The service reads the characters three at a time, with a brief pause between each triplet.

    For more information, see Specifying how strings are spelled out.

    Allowable values: [default,singles,pairs,triples]

    Default: default

  • The percentage change from the default speaking rate of the voice that is used for speech synthesis. Each voice has a default speaking rate that is optimized to represent a normal rate of speech. The parameter accepts an integer that represents the percentage change from the voice's default rate:

    • Specify a signed negative integer to reduce the speaking rate by that percentage. For example, -10 reduces the rate by ten percent.
    • Specify an unsigned or signed positive integer to increase the speaking rate by that percentage. For example, 10 and +10 increase the rate by ten percent.
    • Specify 0 or omit the parameter to get the default speaking rate for the voice.

    The parameter affects the rate for an entire request.

    For more information, see Modifying the speaking rate.

    Default: 0

  • The percentage change from the default speaking pitch of the voice that is used for speech synthesis. Each voice has a default speaking pitch that is optimized to represent a normal tone of voice. The parameter accepts an integer that represents the percentage change from the voice's default tone:

    • Specify a signed negative integer to lower the voice's pitch by that percentage. For example, -5 reduces the tone by five percent.
    • Specify an unsigned or signed positive integer to increase the voice's pitch by that percentage. For example, 5 and +5 increase the tone by five percent.
    • Specify 0 or omit the parameter to get the default speaking pitch for the voice.

    The parameter affects the pitch for an entire request.

    For more information, see Modifying the speaking pitch.

    Default: 0

The text to synthesize. Specify either plain text or a subset of SSML. SSML is an XML-based markup language that provides text annotation for speech-synthesis applications. Pass a maximum of 5 KB of input text. For more information, see

parameters

  • The text to synthesize.

  • The requested format (MIME type) of the audio. You can use the Accept header or the accept parameter to specify the audio format. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

    Default: audio/ogg;codecs=opus

  • The voice to use for speech synthesis. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also:

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The customization ID (GUID) of a custom model to use for the synthesis. If a custom model is specified, it works only if it matches the language of the indicated voice. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified voice with no customization.

  • For German voices, indicates how the service is to spell out strings of individual letters. To indicate the pace of the spelling, specify one of the following values:

    • default - The service reads the characters at the rate at which it synthesizes speech for the request. You can also omit the parameter entirely to achieve the default behavior.
    • singles - The service reads the characters one at a time, with a brief pause between each character.
    • pairs - The service reads the characters two at a time, with a brief pause between each pair.
    • triples - The service reads the characters three at a time, with a brief pause between each triplet.

    For more information, see Specifying how strings are spelled out.

    Allowable values: [default,singles,pairs,triples]

    Default: default

  • The percentage change from the default speaking rate of the voice that is used for speech synthesis. Each voice has a default speaking rate that is optimized to represent a normal rate of speech. The parameter accepts an integer that represents the percentage change from the voice's default rate:

    • Specify a signed negative integer to reduce the speaking rate by that percentage. For example, -10 reduces the rate by ten percent.
    • Specify an unsigned or signed positive integer to increase the speaking rate by that percentage. For example, 10 and +10 increase the rate by ten percent.
    • Specify 0 or omit the parameter to get the default speaking rate for the voice.

    The parameter affects the rate for an entire request.

    For more information, see Modifying the speaking rate.

  • The percentage change from the default speaking pitch of the voice that is used for speech synthesis. Each voice has a default speaking pitch that is optimized to represent a normal tone of voice. The parameter accepts an integer that represents the percentage change from the voice's default tone:

    • Specify a signed negative integer to lower the voice's pitch by that percentage. For example, -5 reduces the tone by five percent.
    • Specify an unsigned or signed positive integer to increase the voice's pitch by that percentage. For example, 5 and +5 increase the tone by five percent.
    • Specify 0 or omit the parameter to get the default speaking pitch for the voice.

    The parameter affects the pitch for an entire request.

    For more information, see Modifying the speaking pitch.

The synthesize options.

parameters

  • The text to synthesize.

  • The requested format (MIME type) of the audio. You can use the Accept header or the accept parameter to specify the audio format. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

    Default: audio/ogg;codecs=opus

  • The voice to use for speech synthesis. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also:

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The customization ID (GUID) of a custom model to use for the synthesis. If a custom model is specified, it works only if it matches the language of the indicated voice. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified voice with no customization.

  • For German voices, indicates how the service is to spell out strings of individual letters. To indicate the pace of the spelling, specify one of the following values:

    • default - The service reads the characters at the rate at which it synthesizes speech for the request. You can also omit the parameter entirely to achieve the default behavior.
    • singles - The service reads the characters one at a time, with a brief pause between each character.
    • pairs - The service reads the characters two at a time, with a brief pause between each pair.
    • triples - The service reads the characters three at a time, with a brief pause between each triplet.

    For more information, see Specifying how strings are spelled out.

    Allowable values: [default,singles,pairs,triples]

    Default: default

  • The percentage change from the default speaking rate of the voice that is used for speech synthesis. Each voice has a default speaking rate that is optimized to represent a normal rate of speech. The parameter accepts an integer that represents the percentage change from the voice's default rate:

    • Specify a signed negative integer to reduce the speaking rate by that percentage. For example, -10 reduces the rate by ten percent.
    • Specify an unsigned or signed positive integer to increase the speaking rate by that percentage. For example, 10 and +10 increase the rate by ten percent.
    • Specify 0 or omit the parameter to get the default speaking rate for the voice.

    The parameter affects the rate for an entire request.

    For more information, see Modifying the speaking rate.

  • The percentage change from the default speaking pitch of the voice that is used for speech synthesis. Each voice has a default speaking pitch that is optimized to represent a normal tone of voice. The parameter accepts an integer that represents the percentage change from the voice's default tone:

    • Specify a signed negative integer to lower the voice's pitch by that percentage. For example, -5 reduces the tone by five percent.
    • Specify an unsigned or signed positive integer to increase the voice's pitch by that percentage. For example, 5 and +5 increase the tone by five percent.
    • Specify 0 or omit the parameter to get the default speaking pitch for the voice.

    The parameter affects the pitch for an entire request.

    For more information, see Modifying the speaking pitch.

parameters

  • The text to synthesize.

  • The requested format (MIME type) of the audio. You can use the Accept header or the accept parameter to specify the audio format. For more information about specifying an audio format, see Audio formats (accept types) in the method description.

    Allowable values: [audio/alaw,audio/basic,audio/flac,audio/l16,audio/ogg,audio/ogg;codecs=opus,audio/ogg;codecs=vorbis,audio/mp3,audio/mpeg,audio/mulaw,audio/wav,audio/webm,audio/webm;codecs=opus,audio/webm;codecs=vorbis]

    Default: audio/ogg;codecs=opus

  • The voice to use for speech synthesis. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also:

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The customization ID (GUID) of a custom model to use for the synthesis. If a custom model is specified, it works only if it matches the language of the indicated voice. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to use the specified voice with no customization.

  • For German voices, indicates how the service is to spell out strings of individual letters. To indicate the pace of the spelling, specify one of the following values:

    • default - The service reads the characters at the rate at which it synthesizes speech for the request. You can also omit the parameter entirely to achieve the default behavior.
    • singles - The service reads the characters one at a time, with a brief pause between each character.
    • pairs - The service reads the characters two at a time, with a brief pause between each pair.
    • triples - The service reads the characters three at a time, with a brief pause between each triplet.

    For more information, see Specifying how strings are spelled out.

    Allowable values: [default,singles,pairs,triples]

    Default: default

  • The percentage change from the default speaking rate of the voice that is used for speech synthesis. Each voice has a default speaking rate that is optimized to represent a normal rate of speech. The parameter accepts an integer that represents the percentage change from the voice's default rate:

    • Specify a signed negative integer to reduce the speaking rate by that percentage. For example, -10 reduces the rate by ten percent.
    • Specify an unsigned or signed positive integer to increase the speaking rate by that percentage. For example, 10 and +10 increase the rate by ten percent.
    • Specify 0 or omit the parameter to get the default speaking rate for the voice.

    The parameter affects the rate for an entire request.

    For more information, see Modifying the speaking rate.

  • The percentage change from the default speaking pitch of the voice that is used for speech synthesis. Each voice has a default speaking pitch that is optimized to represent a normal tone of voice. The parameter accepts an integer that represents the percentage change from the voice's default tone:

    • Specify a signed negative integer to lower the voice's pitch by that percentage. For example, -5 reduces the tone by five percent.
    • Specify an unsigned or signed positive integer to increase the voice's pitch by that percentage. For example, 5 and +5 increase the tone by five percent.
    • Specify 0 or omit the parameter to get the default speaking pitch for the voice.

    The parameter affects the pitch for an entire request.

    For more information, see Modifying the speaking pitch.

  • curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/json" --header "Accept: audio/wav" --data "{\"text\":\"Hello world\"}" --output hello_world.wav "{url}/v1/synthesize?voice=en-US_AllisonV3Voice"

    Download sample audio output file hello_world.wav

  • curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --header "Accept: audio/wav" --data "{\"text\":\"Hello world\"}" --output hello_world.wav "{url}/v1/synthesize?voice=en-US_AllisonV3Voice"

    Download sample audio output file hello_world.wav

  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.Synthesize(
        text: "Hello world",
        accept: "audio/wav",
        voice: "en-US_AllisonV3Voice"
        );
    
    using (FileStream fs = File.Create("hello_world.wav"))
    {
        result.Result.WriteTo(fs);
        fs.Close();
        result.Result.Close();
    }

    Download sample audio output file hello_world.wav

  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.Synthesize(
        text: "Hello world",
        accept: "audio/wav",
        voice: "en-US_AllisonV3Voice"
        );
    
    using (FileStream fs = File.Create("hello_world.wav"))
    {
        result.Result.WriteTo(fs);
        fs.Close();
        result.Result.Close();
    }

    Download sample audio output file hello_world.wav

  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    try {
      SynthesizeOptions synthesizeOptions =
        new SynthesizeOptions.Builder()
          .text("Hello world")
          .accept("audio/wav")
          .voice("en-US_AllisonV3Voice")
          .build();
    
      InputStream inputStream =
        textToSpeech.synthesize(synthesizeOptions).execute().getResult();
      InputStream in = WaveUtils.reWriteWaveHeader(inputStream);
    
      OutputStream out = new FileOutputStream("hello_world.wav");
      byte[] buffer = new byte[1024];
      int length;
      while ((length = in.read(buffer)) > 0) {
        out.write(buffer, 0, length);
      }
    
      out.close();
      in.close();
      inputStream.close();
    } catch (IOException e) {
      e.printStackTrace();
    }

    Download sample audio output file hello_world.wav

  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    try {
      SynthesizeOptions synthesizeOptions =
        new SynthesizeOptions.Builder()
          .text("Hello world")
          .accept("audio/wav")
          .voice("en-US_AllisonV3Voice")
          .build();
    
      InputStream inputStream =
        textToSpeech.synthesize(synthesizeOptions).execute().getResult();
      InputStream in = WaveUtils.reWriteWaveHeader(inputStream);
    
      OutputStream out = new FileOutputStream("hello_world.wav");
      byte[] buffer = new byte[1024];
      int length;
      while ((length = in.read(buffer)) > 0) {
        out.write(buffer, 0, length);
      }
    
      out.close();
      in.close();
      inputStream.close();
    } catch (IOException e) {
      e.printStackTrace();
    }

    Download sample audio output file hello_world.wav

  • const fs = require('fs');
    const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const synthesizeParams = {
      text: 'Hello world',
      accept: 'audio/wav',
      voice: 'en-US_AllisonV3Voice',
    };
    
    textToSpeech.synthesize(synthesizeParams)
      .then(response => {
        // The following line is necessary only for
        // wav formats; otherwise, `response.result`
        // can be directly piped to a file.
        return textToSpeech.repairWavHeaderStream(response.result);
      })
      .then(buffer => {
        fs.writeFileSync('hello_world.wav', buffer);
      })
      .catch(err => {
        console.log('error:', err);
      });

    Download sample audio output file hello_world.wav

  • const fs = require('fs');
    const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const synthesizeParams = {
      text: 'Hello world',
      accept: 'audio/wav',
      voice: 'en-US_AllisonV3Voice',
    };
    
    textToSpeech.synthesize(synthesizeParams)
      .then(response => {
        // The following line is necessary only for
        // wav formats; otherwise, `response.result`
        // can be directly piped to a file.
        return textToSpeech.repairWavHeaderStream(response.result);
      })
      .then(buffer => {
        fs.writeFileSync('hello_world.wav', buffer);
      })
      .catch(err => {
        console.log('error:', err);
      });

    Download sample audio output file hello_world.wav

  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    with open('hello_world.wav', 'wb') as audio_file:
        audio_file.write(
            text_to_speech.synthesize(
                'Hello world',
                voice='en-US_AllisonV3Voice',
                accept='audio/wav'        
            ).get_result().content)

    Download sample audio output file hello_world.wav

  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    with open('hello_world.wav', 'wb') as audio_file:
        audio_file.write(
            text_to_speech.synthesize(
                'Hello world',
                voice='en-US_AllisonV3Voice',
                accept='audio/wav'        
            ).get_result().content)

    Download sample audio output file hello_world.wav

Response

Response type: byte[]

Response type: InputStream

Response type: NodeJS.ReadableStream

Response type: BinaryIO

A binary file that contains the audio of the response.

Status Code

  • OK. The request succeeded.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid. Examples of specific messages include

    • prompt_id '{prompt_id}' not found in custom model '{customization_id}' if you attempt to use a nonexistent or deleted custom prompt.
    • <express-as> is not supported in the current voice if you attempt to use the <express-as> element with a voice that is not one of the expressive neural voices or if you specify an illegal value for the style attribute of the element.
    • Tag <express-as> is missing required attribute->type if you omit the style attribute from the <express-as> element.
    • Emphasis level {level} is not supported if you specify an illegal value for the level attribute of the <emphasis> element.

    If the request fails SSML validation, the description of the error explains the failure. For example, <prosody> with attribute volume is not supported in the current voice. For more information, see SSML validation.

  • Not Found. The specified voice does not exist or, for IBM Cloud Pak for Data, the voice parameter was not specified but the default voice is not installed. The message is Model '{voice}' not found.

  • Not Acceptable. The request specified an incompatible content type or failed to specify a required sampling rate.

  • Unsupported Media Type. The request specified an unacceptable media type.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

Get pronunciation

Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.

See also: Querying a word from a language.

Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.

See also: Querying a word from a language.

Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.

See also: Querying a word from a language.

Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.

See also: Querying a word from a language.

Gets the phonetic pronunciation for the specified word. You can request the pronunciation for a specific format. You can also request the pronunciation for a specific voice to see the default translation for the language of that voice or for a specific custom model to see the translation for that model.

See also: Querying a word from a language.

GET /v1/pronunciation
GetPronunciation(string text, string voice = null, string format = null, string customizationId = null)
ServiceCall<Pronunciation> getPronunciation(GetPronunciationOptions getPronunciationOptions)
getPronunciation(params)
get_pronunciation(
        self,
        text: str,
        *,
        voice: str = None,
        format: str = None,
        customization_id: str = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the GetPronunciationOptions.Builder to create a GetPronunciationOptions object that contains the parameter values for the getPronunciation method.

Query Parameters

  • The word for which the pronunciation is requested.

  • A voice that specifies the language in which the pronunciation is to be returned. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default. All voices for the same language (for example, en-US) return the same translation.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also: Using the default voice.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The phoneme format in which to return the pronunciation. Omit the parameter to obtain the pronunciation in the default format.

    Allowable values: [ibm,ipa]

    Default: ipa

  • The customization ID (GUID) of a custom model for which the pronunciation is to be returned. The language of a specified custom model must match the language of the specified voice. If the word is not defined in the specified custom model, the service returns the default translation for the custom model's language. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see the translation for the specified voice with no customization.

parameters

  • The word for which the pronunciation is requested.

  • A voice that specifies the language in which the pronunciation is to be returned. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default. All voices for the same language (for example, en-US) return the same translation.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also: Using the default voice.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The phoneme format in which to return the pronunciation. Omit the parameter to obtain the pronunciation in the default format.

    Allowable values: [ibm,ipa]

    Default: ipa

  • The customization ID (GUID) of a custom model for which the pronunciation is to be returned. The language of a specified custom model must match the language of the specified voice. If the word is not defined in the specified custom model, the service returns the default translation for the custom model's language. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see the translation for the specified voice with no customization.

The getPronunciation options.

parameters

  • The word for which the pronunciation is requested.

  • A voice that specifies the language in which the pronunciation is to be returned. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default. All voices for the same language (for example, en-US) return the same translation.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also: Using the default voice.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The phoneme format in which to return the pronunciation. Omit the parameter to obtain the pronunciation in the default format.

    Allowable values: [ibm,ipa]

    Default: ipa

  • The customization ID (GUID) of a custom model for which the pronunciation is to be returned. The language of a specified custom model must match the language of the specified voice. If the word is not defined in the specified custom model, the service returns the default translation for the custom model's language. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see the translation for the specified voice with no customization.

parameters

  • The word for which the pronunciation is requested.

  • A voice that specifies the language in which the pronunciation is to be returned. If you omit the voice parameter, the service uses the US English en-US_MichaelV3Voice by default. All voices for the same language (for example, en-US) return the same translation.

    For IBM Cloud Pak for Data, if you do not install the en-US_MichaelV3Voice, you must either specify a voice with the request or specify a new default voice for your installation of the service.

    See also: Using the default voice.

    Allowable values: [de-DE_BirgitV3Voice,de-DE_DieterV3Voice,de-DE_ErikaV3Voice,en-AU_HeidiExpressive,en-AU_JackExpressive,en-GB_CharlotteV3Voice,en-GB_JamesV3Voice,en-GB_KateV3Voice,en-US_AllisonExpressive,en-US_AllisonV3Voice,en-US_EmilyV3Voice,en-US_EmmaExpressive,en-US_HenryV3Voice,en-US_KevinV3Voice,en-US_LisaExpressive,en-US_LisaV3Voice,en-US_MichaelExpressive,en-US_MichaelV3Voice,en-US_OliviaV3Voice,es-ES_EnriqueV3Voice,es-ES_LauraV3Voice,es-LA_SofiaV3Voice,es-US_SofiaV3Voice,fr-CA_LouiseV3Voice,fr-FR_NicolasV3Voice,fr-FR_ReneeV3Voice,it-IT_FrancescaV3Voice,ja-JP_EmiV3Voice,ko-KR_JinV3Voice,nl-NL_MerelV3Voice,pt-BR_IsabelaV3Voice]

    Default: en-US_MichaelV3Voice

  • The phoneme format in which to return the pronunciation. Omit the parameter to obtain the pronunciation in the default format.

    Allowable values: [ibm,ipa]

    Default: ipa

  • The customization ID (GUID) of a custom model for which the pronunciation is to be returned. The language of a specified custom model must match the language of the specified voice. If the word is not defined in the specified custom model, the service returns the default translation for the custom model's language. You must make the request with credentials for the instance of the service that owns the custom model. Omit the parameter to see the translation for the specified voice with no customization.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/pronunciation?text=IEEE&format=ibm&voice=en-US_AllisonV3Voice"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/pronunciation?text=IEEE&format=ibm&voice=en-US_AllisonV3Voice"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetPronunciation(
        text: "IEEE",
        format: "ibm",
        voice: "en-US_AllisonV3Voice"
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetPronunciation(
        text: "IEEE",
        format: "ibm",
        voice: "en-US_AllisonV3Voice"
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetPronunciationOptions getPronunciationOptions =
      new GetPronunciationOptions.Builder()
        .text("IEEE")
        .format("ibm")
        .voice("en-US_AllisonV3Voice")
        .build();
    
    Pronunciation pronunciation =
      textToSpeech.getPronunciation(getPronunciationOptions).execute().getResult();
    System.out.println(pronunciation);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetPronunciationOptions getPronunciationOptions =
      new GetPronunciationOptions.Builder()
        .text("IEEE")
        .format("ibm")
        .voice("en-US_AllisonV3Voice")
        .build();
    
    Pronunciation pronunciation =
      textToSpeech.getPronunciation(getPronunciationOptions).execute().getResult();
    System.out.println(pronunciation);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const getPronunciationParams = {
      text: 'IEEE',
      format: 'ibm',
      voice: 'en-US_AllisonV3Voice',
    };
    
    textToSpeech.getPronunciation(getPronunciationParams)
      .then(pronunciation => {
        console.log(JSON.stringify(pronunciation, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const getPronunciationParams = {
      text: 'IEEE',
      format: 'ibm',
      voice: 'en-US_AllisonV3Voice',
    };
    
    textToSpeech.getPronunciation(getPronunciationParams)
      .then(pronunciation => {
        console.log(JSON.stringify(pronunciation, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    pronunciation = text_to_speech.get_pronunciation(
        text='IEEE',
        voice='en-US_AllisonV3Voice',
        format='ibm'
    ).get_result()
    print(json.dumps(pronunciation, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    pronunciation = text_to_speech.get_pronunciation(
        'IEEE',
        'en-US_AllisonV3Voice',
        'ibm'
    ).get_result()
    print(json.dumps(pronunciation, indent=2))

Response

The pronunciation of the specified text.

The pronunciation of the specified text.

The pronunciation of the specified text.

The pronunciation of the specified text.

The pronunciation of the specified text.

Status Code

  • OK. The request succeeded.

  • Not Modified. The requested resource has not been modified since the time specified by the If-Modified-Since header, as documented in the HTTP specification.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid parameter '{name}' in request
    • Required parameter '{name}' is missing
    • Invalid header value for '{header}'
    • Invalid value for 'customization_id'
    • Customization language {language} does not match the language {language} for voice {voice}
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Not Found. The specified voice does not exist or, for IBM Cloud Pak for Data, the voice parameter was not specified but the default voice is not installed. The message is Model '{voice}' not found.

  • Not Acceptable. The request specified an Accept header with an incompatible content type.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "pronunciation": "`[.1Y] `[.1i] `[.1i] `[.1i]"
    }
  • {
      "pronunciation": "`[.1Y] `[.1i] `[.1i] `[.1i]"
    }

Create a custom model

Creates a new empty custom model. You must specify a name for the new custom model. You can optionally specify the language and a description for the new model. The model is owned by the instance of the service whose credentials are used to create it.

See also: Creating a custom model.

Creates a new empty custom model. You must specify a name for the new custom model. You can optionally specify the language and a description for the new model. The model is owned by the instance of the service whose credentials are used to create it.

See also: Creating a custom model.

Creates a new empty custom model. You must specify a name for the new custom model. You can optionally specify the language and a description for the new model. The model is owned by the instance of the service whose credentials are used to create it.

See also: Creating a custom model.

Creates a new empty custom model. You must specify a name for the new custom model. You can optionally specify the language and a description for the new model. The model is owned by the instance of the service whose credentials are used to create it.

See also: Creating a custom model.

Creates a new empty custom model. You must specify a name for the new custom model. You can optionally specify the language and a description for the new model. The model is owned by the instance of the service whose credentials are used to create it.

See also: Creating a custom model.

POST /v1/customizations
CreateCustomModel(string name, string language = null, string description = null)
ServiceCall<CustomModel> createCustomModel(CreateCustomModelOptions createCustomModelOptions)
createCustomModel(params)
create_custom_model(
        self,
        name: str,
        *,
        language: str = None,
        description: str = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the CreateCustomModelOptions.Builder to create a CreateCustomModelOptions object that contains the parameter values for the createCustomModel method.

Custom Headers

  • The type of the input.

    Allowable values: [application/json]

A CreateCustomModel object that contains information about the new custom model.

parameters

  • The name of the new custom model. Use a localized name that matches the language of the custom model. Use a name that describes the purpose of the custom model, such as Medical custom model or Legal custom model. Use a name that is unique among all custom models that you own.

    Include a maximum of 256 characters in the name. Do not use backslashes, slashes, colons, equal signs, ampersands, or question marks in the name.

  • The language of the new custom model. You create a custom model for a specific language, not for a specific voice. A custom model can be used with any voice for its specified language. Omit the parameter to use the the default language, en-US.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

    Default: en-US

  • A recommended description of the new custom model. Use a localized description that matches the language of the custom model. Include a maximum of 128 characters in the description.

The createCustomModel options.

parameters

  • The name of the new custom model. Use a localized name that matches the language of the custom model. Use a name that describes the purpose of the custom model, such as Medical custom model or Legal custom model. Use a name that is unique among all custom models that you own.

    Include a maximum of 256 characters in the name. Do not use backslashes, slashes, colons, equal signs, ampersands, or question marks in the name.

  • The language of the new custom model. You create a custom model for a specific language, not for a specific voice. A custom model can be used with any voice for its specified language. Omit the parameter to use the the default language, en-US.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

    Default: en-US

  • A recommended description of the new custom model. Use a localized description that matches the language of the custom model. Include a maximum of 128 characters in the description.

parameters

  • The name of the new custom model. Use a localized name that matches the language of the custom model. Use a name that describes the purpose of the custom model, such as Medical custom model or Legal custom model. Use a name that is unique among all custom models that you own.

    Include a maximum of 256 characters in the name. Do not use backslashes, slashes, colons, equal signs, ampersands, or question marks in the name.

  • The language of the new custom model. You create a custom model for a specific language, not for a specific voice. A custom model can be used with any voice for its specified language. Omit the parameter to use the the default language, en-US.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

    Default: en-US

  • A recommended description of the new custom model. Use a localized description that matches the language of the custom model. Include a maximum of 128 characters in the description.

  • curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{\"name\":\"First Model\", \"language\":\"en-US\", \"description\":\"First custom model\"}" "{url}/v1/customizations"
  • curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{\"name\":\"First Model\", \"language\":\"en-US\", \"description\":\"First custom voice model\"}" "{url}/v1/customizations"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.CreateCustomModel(
        name: "First Model",
        language: "en-US",
        description: "First custom model"
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.CreateCustomModel(
        name: "First Model",
        language: "en-US",
        description: "First custom model"
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    CreateCustomModelOptions createCustomModelOptions =
      new CreateCustomModelOptions.Builder()
        .name("First Model")
        .language("en-US")
        .description("First custom model")
        .build();
    
    CustomModel customModel =
      textToSpeech.createCustomModel(createCustomModelOptions).execute().getResult();
    System.out.println(customModel);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    CreateCustomModelOptions createCustomModelOptions =
      new CreateCustomModelOptions.Builder()
        .name("First Model")
        .language("en-US")
        .description("First custom model")
        .build();
    
    CustomModel customModel =
      textToSpeech.createCustomModel(createCustomModelOptions).execute().getResult();
    System.out.println(customModel);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const createCustomModelParams = {
      name: 'First Model',
      language: 'en-US',
      description: 'First custom model',
    };
    
    textToSpeech.createCustomModel(createCustomModelParams)
      .then(customModel => {
        console.log(JSON.stringify(customModel, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const createCustomModelParams = {
      name: 'First Model',
      language: 'en-US',
      description: 'First custom model',
    };
    
    textToSpeech.createCustomModel(createCustomModelParams)
      .then(customModel => {
        console.log(JSON.stringify(customModel, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    custom_model = text_to_speech.create_custom_model(
        name='First Model',
        language='en-US',
        description='First custom model'
    ).get_result()
    print(json.dumps(custom_model, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    custom_model = text_to_speech.create_custom_model(
        'First Model',
        'en-US',
        'First custom model'
    ).get_result()
    print(json.dumps(custom_model, indent=2))

Response

Information about an existing custom model.

Information about an existing custom model.

Information about an existing custom model.

Information about an existing custom model.

Information about an existing custom model.

Status Code

  • Created. The custom model was successfully created.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid parameter '{name}' in request
    • Required parameter '{name}' is missing
    • Invalid header value for '{header}'
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "customization_id": "51e996ea-86ca-482e-b7ec-0f31c34e5ee9"
    }
  • {
      "customization_id": "51e996ea-86ca-482e-b7ec-0f31c34e5ee9"
    }

List custom models

Lists metadata such as the name and description for all custom models that are owned by an instance of the service. Specify a language to list the custom models for that language only. To see the words and prompts in addition to the metadata for a specific custom model, use the Get a custom model method. You must use credentials for the instance of the service that owns a model to list information about it.

See also: Querying all custom models.

Lists metadata such as the name and description for all custom models that are owned by an instance of the service. Specify a language to list the custom models for that language only. To see the words and prompts in addition to the metadata for a specific custom model, use the Get a custom model method. You must use credentials for the instance of the service that owns a model to list information about it.

See also: Querying all custom models.

Lists metadata such as the name and description for all custom models that are owned by an instance of the service. Specify a language to list the custom models for that language only. To see the words and prompts in addition to the metadata for a specific custom model, use the Get a custom model method. You must use credentials for the instance of the service that owns a model to list information about it.

See also: Querying all custom models.

Lists metadata such as the name and description for all custom models that are owned by an instance of the service. Specify a language to list the custom models for that language only. To see the words and prompts in addition to the metadata for a specific custom model, use the Get a custom model method. You must use credentials for the instance of the service that owns a model to list information about it.

See also: Querying all custom models.

Lists metadata such as the name and description for all custom models that are owned by an instance of the service. Specify a language to list the custom models for that language only. To see the words and prompts in addition to the metadata for a specific custom model, use the Get a custom model method. You must use credentials for the instance of the service that owns a model to list information about it.

See also: Querying all custom models.

GET /v1/customizations
ListCustomModels(string language = null)
ServiceCall<CustomModels> listCustomModels(ListCustomModelsOptions listCustomModelsOptions)
listCustomModels(params)
list_custom_models(
        self,
        *,
        language: str = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the ListCustomModelsOptions.Builder to create a ListCustomModelsOptions object that contains the parameter values for the listCustomModels method.

Query Parameters

  • The language for which custom models that are owned by the requesting credentials are to be returned. Omit the parameter to see all custom models that are owned by the requester.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

parameters

  • The language for which custom models that are owned by the requesting credentials are to be returned. Omit the parameter to see all custom models that are owned by the requester.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

The listCustomModels options.

parameters

  • The language for which custom models that are owned by the requesting credentials are to be returned. Omit the parameter to see all custom models that are owned by the requester.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

parameters

  • The language for which custom models that are owned by the requesting credentials are to be returned. Omit the parameter to see all custom models that are owned by the requester.

    Allowable values: [de-DE,en-AU,en-GB,en-US,es-ES,es-LA,es-US,fr-CA,fr-FR,it-IT,ja-JP,nl-NL,pt-BR]

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListCustomModels();
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListCustomModels();
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    CustomModels customModels = textToSpeech.listCustomModels().execute().getResult();
    System.out.println(customModels);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    CustomModels customModels = textToSpeech.listCustomModels().execute().getResult();
    System.out.println(customModels);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.listCustomModels()
      .then(customModels => {
        console.log(JSON.stringify(customModels, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.listCustomModels()
      .then(customModels => {
        console.log(JSON.stringify(customModels, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    custom_models = text_to_speech.list_custom_models().get_result()
    print(json.dumps(custom_models, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    custom_models = text_to_speech.list_custom_models().get_result()
    print(json.dumps(custom_models, indent=2))

Response

Information about existing custom models.

Information about existing custom models.

Information about existing custom models.

Information about existing custom models.

Information about existing custom models.

Status Code

  • OK. The request succeeded.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'language'
    • Invalid header value for '{header}'
    • Input parameter '{parameter}' is invalid
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "customizations": [
        {
          "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
          "language": "en-US",
          "created": "2016-07-15T19:15:17.926Z",
          "customization_id": "a4df11a9-7cf9-48e8-8319-08fb7c3b1aa8",
          "name": "Second Model",
          "description": "Second custom model",
          "last_modified": "2016-07-15T19:15:17.926Z"
        },
        {
          "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
          "language": "en-US",
          "created": "2016-07-15T18:12:31.743Z",
          "customization_id": "53506a62-6861-41f5-9a44-352047edcf6f",
          "name": "First Model Update",
          "description": "First custom model update",
          "last_modified": "2016-07-15T18:23:50.912Z"
        }
      ]
    }
  • {
      "customizations": [
        {
          "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
          "language": "en-US",
          "created": "2016-07-15T19:15:17.926Z",
          "customization_id": "a4df11a9-7cf9-48e8-8319-08fb7c3b1aa8",
          "name": "Second Model",
          "description": "Second custom model",
          "last_modified": "2016-07-15T19:15:17.926Z"
        },
        {
          "owner": "53fd7517-af0d-849d-801b-6e042a5d2f22",
          "language": "en-US",
          "created": "2016-07-15T18:12:31.743Z",
          "customization_id": "53506a62-6861-41f5-9a44-352047edcf6f",
          "name": "First Model Update",
          "description": "First custom model update",
          "last_modified": "2016-07-15T18:23:50.912Z"
        }
      ]
    }

Update a custom model

Updates information for the specified custom model. You can update metadata such as the name and description of the model. You can also update the words in the model and their translations. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to update it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Updates information for the specified custom model. You can update metadata such as the name and description of the model. You can also update the words in the model and their translations. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to update it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Updates information for the specified custom model. You can update metadata such as the name and description of the model. You can also update the words in the model and their translations. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to update it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Updates information for the specified custom model. You can update metadata such as the name and description of the model. You can also update the words in the model and their translations. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to update it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Updates information for the specified custom model. You can update metadata such as the name and description of the model. You can also update the words in the model and their translations. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to update it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

POST /v1/customizations/{customization_id}
UpdateCustomModel(string customizationId, string name = null, string description = null, List<Word> words = null)
ServiceCall<Void> updateCustomModel(UpdateCustomModelOptions updateCustomModelOptions)
updateCustomModel(params)
update_custom_model(
        self,
        customization_id: str,
        *,
        name: str = None,
        description: str = None,
        words: List['Word'] = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the UpdateCustomModelOptions.Builder to create a UpdateCustomModelOptions object that contains the parameter values for the updateCustomModel method.

Custom Headers

  • The type of the input.

    Allowable values: [application/json]

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

An UpdateCustomModel object that contains information that is to be updated for the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • A new name for the custom model.

  • A new description for the custom model.

  • An array of Word objects that provides the words and their translations that are to be added or updated for the custom model. Pass an empty array to make no additions or updates.

The updateCustomModel options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • A new name for the custom model.

  • A new description for the custom model.

  • An array of Word objects that provides the words and their translations that are to be added or updated for the custom model. Pass an empty array to make no additions or updates.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • A new name for the custom model.

  • A new description for the custom model.

  • An array of Word objects that provides the words and their translations that are to be added or updated for the custom model. Pass an empty array to make no additions or updates.

  • curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{\"name\":\"First Model Update\", \"description\":\"First custom model update\", \"words\":[ {\"word\":\"NCAA\", \"translation\":\"N C double A\"}, {\"word\":\"iPhone\", \"translation\":\"I phone\"} ]}" "{url}/v1/customizations/{customization_id}"
  • curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{\"name\":\"First Model Update\", \"description\":\"First custom voice model update\", \"words\":[ {\"word\":\"NCAA\", \"translation\":\"N C double A\"}, {\"word\":\"iPhone\", \"translation\":\"I phone\"} ]}" "{url}/v1/customizations/{customization_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var words = new List<Word>()
    {
        new Word()
        {
            _Word = "NCAA",
            Translation = "N C double A"
        },
        new Word()
        {
            _Word = "iPhone",
            Translation = "I phone"
        }
    };
    
    var result = textToSpeech.UpdateCustomModel(
        customizationId: "{customizationId}",
        name: "First Model Update",
        description: "First custom model update",
        words: words
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var words = new List<Word>()
    {
        new Word()
        {
            _Word = "NCAA",
            Translation = "N C double A"
        },
        new Word()
        {
            _Word = "iPhone",
            Translation = "I phone"
        }
    };
    
    var result = textToSpeech.UpdateCustomModel(
        customizationId: "{customizationId}",
        name: "First Model Update",
        description: "First custom model update",
        words: words
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    List<Word> words = new ArrayList<Word>();
    
    Word word = new Word();
    word.setWord("NCAA");
    word.setTranslation("N C double A");
    words.add(word);
    
    word = new Word();
    word.setWord("iPhone");
    word.setTranslation("I phone");
    words.add(word);
    
    UpdateCustomModelOptions updateCustomModelOptions =
      new UpdateCustomModelOptions.Builder()
        .customizationId("{customizationId}")
        .name("First Model Update")
        .description("First custom model update")
        .words(words)
        .build();
    
    textToSpeech.updateCustomModel(updateCustomModelOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    List<Word> words = new ArrayList<Word>();
    
    Word word = new Word();
    word.setWord("NCAA");
    word.setTranslation("N C double A");
    words.add(word);
    
    word = new Word();
    word.setWord("iPhone");
    word.setTranslation("I phone");
    words.add(word);
    
    UpdateCustomModelOptions updateCustomModelOptions =
      new UpdateCustomModelOptions.Builder()
        .customizationId("{customizationId}")
        .name("First Model Update")
        .description("First custom model update")
        .words(words)
        .build();
    
    textToSpeech.updateCustomModel(updateCustomModelOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const updateCustomModelParams = {
      customizationId: '{customization_id}',
      name: 'First Model Update',
      description: 'First custom model update',
      words: [
        { word: 'NCAA', translation: 'N C double A' },
        { word: 'iPhone', translation: 'I phone' },
      ],
    };
    
    textToSpeech.updateCustomModel(updateCustomModelParams)
      .then(result => {
        console.log(JSON.stringify(result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const updateCustomModelParams = {
      customizationId: '{customization_id}',
      name: 'First Model Update',
      description: 'First custom model update',
      words: [
        { word: 'NCAA', translation: 'N C double A' },
        { word: 'iPhone', translation: 'I phone' },
      ],
    };
    
    textToSpeech.updateCustomModel(updateCustomModelParams)
      .then(result => {
        console.log(JSON.stringify(result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.update_custom_model(
        '{customization_id}',
        name='First Model Update',
        description='First custom model update',
        words=[{'word': 'NCAA', 'translation': 'N C double A'},
         {'word': 'iPhone', 'translation': 'I phone'}]
    )
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.update_custom_model(
        '{customization_id}',
        'First Model Update',
        'First custom model update',
        [{'word': 'NCAA', 'translation': 'N C double A'},
         {'word': 'iPhone', 'translation': 'I phone'}]
    )

Response

Response type: object

Status Code

  • OK. The custom model was successfully updated.

  • Bad request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. If the request fails SSML validation, the description of the error explains the failure; for more information, see SSML validation. Specific messages include

    • Invalid parameter '{name}' in request
    • Invalid value for 'customization_id'
    • For word: '{word}', <phoneme alphabet="{alphabet}" ph="{translation}"></phoneme> is not a standard SSML format
    • In SSML: <phoneme alphabet="ipa" ph="{translation}"></phoneme>, attribute 'ph' is not a standard IPA format
    • In SSML: <phoneme alphabet="ibm" ph="{translation}"></phoneme>, attribute 'ph' is not a standard SPR format
    • Invalid part_of_speech name
    • Part of speech is supported for ja-JP language only
    • Invalid header value for '{header}'
    • Invalid request
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {}
  • {}

Get a custom model

Gets all information about a specified custom model. In addition to metadata such as the name and description of the custom model, the output includes the words and their translations that are defined for the model, as well as any prompts that are defined for the model. To see just the metadata for a model, use the List custom models method.

See also: Querying a custom model.

Gets all information about a specified custom model. In addition to metadata such as the name and description of the custom model, the output includes the words and their translations that are defined for the model, as well as any prompts that are defined for the model. To see just the metadata for a model, use the List custom models method.

See also: Querying a custom model.

Gets all information about a specified custom model. In addition to metadata such as the name and description of the custom model, the output includes the words and their translations that are defined for the model, as well as any prompts that are defined for the model. To see just the metadata for a model, use the List custom models method.

See also: Querying a custom model.

Gets all information about a specified custom model. In addition to metadata such as the name and description of the custom model, the output includes the words and their translations that are defined for the model, as well as any prompts that are defined for the model. To see just the metadata for a model, use the List custom models method.

See also: Querying a custom model.

Gets all information about a specified custom model. In addition to metadata such as the name and description of the custom model, the output includes the words and their translations that are defined for the model, as well as any prompts that are defined for the model. To see just the metadata for a model, use the List custom models method.

See also: Querying a custom model.

GET /v1/customizations/{customization_id}
GetCustomModel(string customizationId)
ServiceCall<CustomModel> getCustomModel(GetCustomModelOptions getCustomModelOptions)
getCustomModel(params)
get_custom_model(
        self,
        customization_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the GetCustomModelOptions.Builder to create a GetCustomModelOptions object that contains the parameter values for the getCustomModel method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

The getCustomModel options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetCustomModel(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetCustomModel(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetCustomModelOptions getCustomModelOptions =
      new GetCustomModelOptions.Builder()
        .customizationId("{customizationId}")
        .build();
    
    CustomModel customModel =
      textToSpeech.getCustomModel(getCustomModelOptions).execute().getResult();
    System.out.println(customModel);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetCustomModelOptions getCustomModelOptions =
      new GetCustomModelOptions.Builder()
        .customizationId("{customizationId}")
        .build();
    
    CustomModel customModel =
      textToSpeech.getCustomModel(getCustomModelOptions).execute().getResult();
    System.out.println(customModel);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const getCustomModelParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.getCustomModel(getCustomModelParams)
      .then(customModel => {
        console.log(JSON.stringify(customModel, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const getCustomModelParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.getCustomModel(getCustomModelParams)
      .then(customModel => {
        console.log(JSON.stringify(customModel, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    custom_model = text_to_speech.get_custom_model('{customization_id'}).get_result()
    print(json.dumps(custom_model, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    custom_model = text_to_speech.get_custom_model('{customization_id'}).get_result()
    print(json.dumps(custom_model, indent=2))

Response

Information about an existing custom model.

Information about an existing custom model.

Information about an existing custom model.

Information about an existing custom model.

Information about an existing custom model.

Status Code

  • OK. The request succeeded.

  • Not Modified. The requested resource has not been modified since the time specified by the If-Modified-Since header, as documented in the HTTP specification.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'customization_id'
    • Invalid header value for '{header}'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "customization_id": "d76ea7bb-cc91-4591-a9fb-aabf048dcc61",
      "name": "First Model Update",
      "description": "First custom model update",
      "language": "en-US",
      "owner": "35df7157-fad0-498c-912c-6e429f5c1e11",
      "created": "2017-01-23T16:00:32.893",
      "last_modified": "2017-01-23T16:00:35.619",
      "words": [
        {
          "word": "NCAA",
          "translation": "N C double A"
        },
        {
          "word": "iPhone",
          "translation": "I phone"
        }
      ],
      "prompts": [
        {
          "prompt": "Hello and welcome!",
          "prompt_id": "greeting",
          "status": "available",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        },
        {
          "prompt": "How can I help you today?",
          "prompt_id": "help",
          "status": "processing",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        }
      ]
    }
  • {
      "customization_id": "d76ea7bb-cc91-4591-a9fb-aabf048dcc61",
      "name": "First Model Update",
      "description": "First custom model update",
      "language": "en-US",
      "owner": "35df7157-fad0-498c-912c-6e429f5c1e11",
      "created": "2017-01-23T16:00:32.893",
      "last_modified": "2017-01-23T16:00:35.619",
      "words": [
        {
          "word": "NCAA",
          "translation": "N C double A"
        },
        {
          "word": "iPhone",
          "translation": "I phone"
        }
      ],
      "prompts": [
        {
          "prompt": "Hello and welcome!",
          "prompt_id": "greeting",
          "status": "available",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        },
        {
          "prompt": "How can I help you today?",
          "prompt_id": "help",
          "status": "processing",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        }
      ]
    }

Delete a custom model

Deletes the specified custom model. You must use credentials for the instance of the service that owns a model to delete it.

See also: Deleting a custom model.

Deletes the specified custom model. You must use credentials for the instance of the service that owns a model to delete it.

See also: Deleting a custom model.

Deletes the specified custom model. You must use credentials for the instance of the service that owns a model to delete it.

See also: Deleting a custom model.

Deletes the specified custom model. You must use credentials for the instance of the service that owns a model to delete it.

See also: Deleting a custom model.

Deletes the specified custom model. You must use credentials for the instance of the service that owns a model to delete it.

See also: Deleting a custom model.

DELETE /v1/customizations/{customization_id}
DeleteCustomModel(string customizationId)
ServiceCall<Void> deleteCustomModel(DeleteCustomModelOptions deleteCustomModelOptions)
deleteCustomModel(params)
delete_custom_model(
        self,
        customization_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the DeleteCustomModelOptions.Builder to create a DeleteCustomModelOptions object that contains the parameter values for the deleteCustomModel method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

The deleteCustomModel options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • curl -X DELETE -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}"
  • curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteCustomModel(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteCustomModel(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteCustomModelOptions deleteCustomModelOptions =
      new DeleteCustomModelOptions.Builder()
        .customizationId("{customizationId}")
        .build();
    
    textToSpeech.deleteCustomModel(deleteCustomModelOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteCustomModelOptions deleteCustomModelOptions =
      new DeleteCustomModelOptions.Builder()
        .customizationId("{customizationId}")
        .build();
    
    textToSpeech.deleteCustomModel(deleteCustomModelOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteCustomModelParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.deleteCustomModel(deleteCustomModelParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteCustomModelParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.deleteCustomModel(deleteCustomModelParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_custom_model('{customization_id}')
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_custom_model('{customization_id}')

Response

Response type: object

Status Code

  • No Content. The custom model was successfully deleted.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'customization_id'
    • Invalid header value for '{header}'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

Add custom words

Adds one or more words and their translations to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add words to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds one or more words and their translations to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add words to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds one or more words and their translations to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add words to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds one or more words and their translations to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add words to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds one or more words and their translations to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add words to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

POST /v1/customizations/{customization_id}/words
AddWords(string customizationId, List<Word> words)
ServiceCall<Void> addWords(AddWordsOptions addWordsOptions)
addWords(params)
add_words(
        self,
        customization_id: str,
        words: List['Word'],
        **kwargs,
    ) -> DetailedResponse

Request

Use the AddWordsOptions.Builder to create a AddWordsOptions object that contains the parameter values for the addWords method.

Custom Headers

  • The type of the input.

    Allowable values: [application/json]

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

For the Add custom words method, one or more words that are to be added or updated for the custom model and the translation for each specified word.

For the List custom words method, the words and their translations from the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The Add custom words method accepts an array of Word objects. Each object provides a word that is to be added or updated for the custom model and the word's translation.

    The List custom words method returns an array of Word objects. Each object shows a word and its translation from the custom model. The words are listed in alphabetical order, with uppercase letters listed before lowercase letters. The array is empty if the custom model contains no words.

The addWords options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The Add custom words method accepts an array of Word objects. Each object provides a word that is to be added or updated for the custom model and the word's translation.

    The List custom words method returns an array of Word objects. Each object shows a word and its translation from the custom model. The words are listed in alphabetical order, with uppercase letters listed before lowercase letters. The array is empty if the custom model contains no words.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The Add custom words method accepts an array of Word objects. Each object provides a word that is to be added or updated for the custom model and the word's translation.

    The List custom words method returns an array of Word objects. Each object shows a word and its translation from the custom model. The words are listed in alphabetical order, with uppercase letters listed before lowercase letters. The array is empty if the custom model contains no words.

  • curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{\"words\": [ {\"word\":\"EEE\", \"translation\":\"<phoneme alphabet=\\\"ibm\\\" ph=\\\"tr1Ipxl.1i\\\"></phoneme>\"}, {\"word\":\"IEEE\", \"translation\":\"<phoneme alphabet=\\\"ibm\\\" ph=\\\"1Y.tr1Ipxl.1i\\\"></phoneme>\"} ]}" "{url}/v1/customizations/{customization_id}/words"
  • curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{\"words\": [ {\"word\":\"EEE\", \"translation\":\"<phoneme alphabet=\\\"ibm\\\" ph=\\\"tr1Ipxl.1i\\\"></phoneme>\"}, {\"word\":\"IEEE\", \"translation\":\"<phoneme alphabet=\\\"ibm\\\" ph=\\\"1Y.tr1Ipxl.1i\\\"></phoneme>\"} ]}" "{url}/v1/customizations/{customization_id}/words"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var words = new List<Word>()
    {
        new Word()
        {
            _Word = "EEE",
            Translation = "<phoneme alphabet=\"ibm\" ph=\"tr1Ipxl.1i\"></phoneme>"
        },
        new Word()
        {
            _Word = "IEEE",
            Translation = "<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>"
        }
    };
    
    var result = textToSpeech.AddWords(
        customizationId: "{customizationId}",
        words: words
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var words = new List<Word>()
    {
        new Word()
        {
            _Word = "EEE",
            Translation = "<phoneme alphabet=\"ibm\" ph=\"tr1Ipxl.1i\"></phoneme>"
        },
        new Word()
        {
            _Word = "IEEE",
            Translation = "<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>"
        }
    };
    
    var result = textToSpeech.AddWords(
        customizationId: "{customizationId}",
        words: words
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    List<Word> newWords = new ArrayList<Word>();
    
    Word word = new Word();
    word.setWord("EEE");
    word.setTranslation("<phoneme alphabet=\"ibm\" ph=\"tr1Ipxl.1i\"></phoneme>");
    newWords.add(word);
    
    word = new Word();
    word.setWord("IEEE");
    word.setTranslation("<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>");
    newWords.add(word);
    
    AddWordsOptions addWordsOptions = new AddWordsOptions.Builder()
      .customizationId("{customizationId}")
      .words(newWords)
      .build();
    
    textToSpeech.addWords(addWordsOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    List<Word> newWords = new ArrayList<Word>();
    
    Word word = new Word();
    word.setWord("EEE");
    word.setTranslation("<phoneme alphabet=\"ibm\" ph=\"tr1Ipxl.1i\"></phoneme>");
    newWords.add(word);
    
    word = new Word();
    word.setWord("IEEE");
    word.setTranslation("<phoneme alphabet=\"ibm\" ph=\"1Y.tr1Ipxl.1i\"></phoneme>");
    newWords.add(word);
    
    AddWordsOptions addWordsOptions = new AddWordsOptions.Builder()
      .customizationId("{customizationId}")
      .words(newWords)
      .build();
    
    textToSpeech.addWords(addWordsOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const addWordsParams = {
      customizationId: '{customization_id}',
      words: [
        {
          word: 'EEE',
          translation: '<phoneme alphabet="ibm" ph="tr1Ipxl.1i"></phoneme>',
        },
        {
          word: 'IEEE',
          translation: '<phoneme alphabet="ibm" ph="1Y.tr1Ipxl.1i"></phoneme>',
        },
      ],
    };
    
    textToSpeech.addWords(addWordsParams)
      .then(result => {
        console.log(JSON.stringify(result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const addWordsParams = {
      customizationId: '{customization_id}',
      words: [
        {
          word: 'EEE',
          translation: '<phoneme alphabet="ibm" ph="tr1Ipxl.1i"></phoneme>',
        },
        {
          word: 'IEEE',
          translation: '<phoneme alphabet="ibm" ph="1Y.tr1Ipxl.1i"></phoneme>',
        },
      ],
    };
    
    textToSpeech.addWords(addWordsParams)
      .then(result => {
        console.log(JSON.stringify(result, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.add_words(
        '{customization_id}',
        words=[{'word': 'EEE',
          'translation': '<phoneme alphabet="ibm" ph="tr1Ipxl.1i"></phoneme>'},
         {'word': 'IEEE',
          'translation': '<phoneme alphabet="ibm" ph="1Y.tr1Ipxl.1i"></phoneme>'}]
    )
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.add_words(
        '{customization_id}',
        [{'word': 'EEE',
          'translation': '<phoneme alphabet="ibm" ph="tr1Ipxl.1i"></phoneme>'},
         {'word': 'IEEE',
          'translation': '<phoneme alphabet="ibm" ph="1Y.tr1Ipxl.1i"></phoneme>'}]
    )

Response

Response type: object

Status Code

  • OK. The words were successfully added to the custom model.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. If the request fails SSML validation, the description of the error explains the failure; for more information, see SSML validation. Specific messages include

    • Invalid parameter '{name}' in request
    • Invalid value for 'customization_id'
    • <phoneme alphabet="{alphabet}" ph="{translation}"></phoneme> is not a standard SSML format
    • In SSML: <phoneme alphabet="ipa" ph="{translation}"></phoneme>, attribute 'ph' is not a standard IPA format
    • In SSML: <phoneme alphabet="ibm" ph="{translation}"></phoneme>, attribute 'ph' is not a standard SPR format
    • Invalid part_of_speech name
    • Part of speech is supported for ja-JP language only
    • Invalid header value for '{header}'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {}
  • {}

List custom words

Lists all of the words and their translations for the specified custom model. The output shows the translations as they are defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying all words from a custom model.

Lists all of the words and their translations for the specified custom model. The output shows the translations as they are defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying all words from a custom model.

Lists all of the words and their translations for the specified custom model. The output shows the translations as they are defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying all words from a custom model.

Lists all of the words and their translations for the specified custom model. The output shows the translations as they are defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying all words from a custom model.

Lists all of the words and their translations for the specified custom model. The output shows the translations as they are defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying all words from a custom model.

GET /v1/customizations/{customization_id}/words
ListWords(string customizationId)
ServiceCall<Words> listWords(ListWordsOptions listWordsOptions)
listWords(params)
list_words(
        self,
        customization_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the ListWordsOptions.Builder to create a ListWordsOptions object that contains the parameter values for the listWords method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

The listWords options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/words"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/words"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListWords(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListWords(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    ListWordsOptions listWordsOptions = new ListWordsOptions.Builder()
      .customizationId("{customizationId}")
      .build();
    
    Words words = textToSpeech.listWords(listWordsOptions).execute().getResult();
    System.out.println(words);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    ListWordsOptions listWordsOptions = new ListWordsOptions.Builder()
      .customizationId("{customizationId}")
      .build();
    
    Words words = textToSpeech.listWords(listWordsOptions).execute().getResult();
    System.out.println(words);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const listWordsParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.listWords(listWordsParams)
      .then(words => {
        console.log(JSON.stringify(words, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const listWordsParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.listWords(listWordsParams)
      .then(words => {
        console.log(JSON.stringify(words, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    words = text_to_speech.list_words('{customization_id}').get_result()
    print(json.dumps(words, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    words = text_to_speech.list_words('{customization_id}').get_result()
    print(json.dumps(words, indent=2))

Response

For the Add custom words method, one or more words that are to be added or updated for the custom model and the translation for each specified word.

For the List custom words method, the words and their translations from the custom model.

For the Add custom words method, one or more words that are to be added or updated for the custom model and the translation for each specified word.

For the List custom words method, the words and their translations from the custom model.

For the Add custom words method, one or more words that are to be added or updated for the custom model and the translation for each specified word.

For the List custom words method, the words and their translations from the custom model.

For the Add custom words method, one or more words that are to be added or updated for the custom model and the translation for each specified word.

For the List custom words method, the words and their translations from the custom model.

For the Add custom words method, one or more words that are to be added or updated for the custom model and the translation for each specified word.

For the List custom words method, the words and their translations from the custom model.

Status Code

  • OK. The request succeeded.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'customization_id'
    • Invalid header value for '{header}'
    • Dictionary format error (if the custom model contains no words)
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "words": [
        {
          "word": "NCAA",
          "translation": "N C double A"
        },
        {
          "word": "ACLs",
          "translation": "ackles"
        },
        {
          "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>"
        }
      ]
    }
  • {
      "words": [
        {
          "word": "NCAA",
          "translation": "N C double A"
        },
        {
          "word": "ACLs",
          "translation": "ackles"
        },
        {
          "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>"
        }
      ]
    }

Add a custom word

Adds a single word and its translation to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add a word to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds a single word and its translation to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add a word to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds a single word and its translation to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add a word to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds a single word and its translation to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add a word to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

Adds a single word and its translation to the specified custom model. Adding a new translation for a word that already exists in a custom model overwrites the word's existing translation. A custom model can contain no more than 20,000 entries. You must use credentials for the instance of the service that owns a model to add a word to it.

You can define sounds-like or phonetic translations for words. A sounds-like translation consists of one or more words that, when combined, sound like the word. Phonetic translations are based on the SSML phoneme format for representing a word. You can specify them in standard International Phonetic Alphabet (IPA) representation

<phoneme alphabet="ipa" ph="təmˈɑto"></phoneme>

or in the proprietary IBM Symbolic Phonetic Representation (SPR)

<phoneme alphabet="ibm" ph="1gAstroEntxrYFXs"></phoneme>

See also:

PUT /v1/customizations/{customization_id}/words/{word}
AddWord(string customizationId, string word, string translation, string partOfSpeech = null)
ServiceCall<Void> addWord(AddWordOptions addWordOptions)
addWord(params)
add_word(
        self,
        customization_id: str,
        word: str,
        translation: str,
        *,
        part_of_speech: str = None,
        **kwargs,
    ) -> DetailedResponse

Request

Use the AddWordOptions.Builder to create a AddWordOptions object that contains the parameter values for the addWord method.

Custom Headers

  • The type of the input.

    Allowable values: [application/json]

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be added or updated for the custom model.

The translation for the word that is to be added or updated.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be added or updated for the custom model.

  • 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 translation or as an IBM SPR translation. A sounds-like is one or more words that, when combined, sound like the word.

  • Japanese only. The part of speech for the word. The service uses the value to produce the correct intonation for the word. You can create only a single entry, with or without a single part of speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For more information, see Working with Japanese entries.

    Allowable values: [Dosi,Fuku,Gobi,Hoka,Jodo,Josi,Kato,Kedo,Keyo,Kigo,Koyu,Mesi,Reta,Stbi,Stto,Stzo,Suji]

The addWord options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be added or updated for the custom model.

  • 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 translation or as an IBM SPR translation. A sounds-like is one or more words that, when combined, sound like the word.

  • Japanese only. The part of speech for the word. The service uses the value to produce the correct intonation for the word. You can create only a single entry, with or without a single part of speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For more information, see Working with Japanese entries.

    Allowable values: [Dosi,Fuku,Gobi,Hoka,Jodo,Josi,Kato,Kedo,Keyo,Kigo,Koyu,Mesi,Reta,Stbi,Stto,Stzo,Suji]

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be added or updated for the custom model.

  • 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 translation or as an IBM SPR translation. A sounds-like is one or more words that, when combined, sound like the word.

  • Japanese only. The part of speech for the word. The service uses the value to produce the correct intonation for the word. You can create only a single entry, with or without a single part of speech, for any word; you cannot create multiple entries with different parts of speech for the same word. For more information, see Working with Japanese entries.

    Allowable values: [Dosi,Fuku,Gobi,Hoka,Jodo,Josi,Kato,Kedo,Keyo,Kigo,Koyu,Mesi,Reta,Stbi,Stto,Stzo,Suji]

  • curl -X PUT -u "apikey:{apikey}" --header "Content-Type: application/json" --data "{\"translation\":\"ackles\"}" "{url}/v1/customizations/{customization_id}/words/ACLs"
  • curl -X PUT --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --data "{\"translation\":\"ackles\"}" "{url}/v1/customizations/{customization_id}/words/ACLs"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.AddWord(
        customizationId: "{customizationId}",
        word: "ACLs",
        translation: "ackles"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.AddWord(
        customizationId: "{customizationId}",
        word: "ACLs",
        translation: "ackles"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    AddWordOptions addWordOptions = new AddWordOptions.Builder()
      .customizationId("{customizationId}")
      .word("ACLs")
      .translation("ackles")
      .build();
    
    textToSpeech.addWord(addWordOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    AddWordOptions addWordOptions = new AddWordOptions.Builder()
      .customizationId("{customizationId}")
      .word("ACLs")
      .translation("ackles")
      .build();
    
    textToSpeech.addWord(addWordOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const addWordParams = {
      customizationId: '{customization_id}',
      word: 'ACLs',
      translation: 'ackles',
    };
    
    textToSpeech.addWord(addWordParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const addWordParams = {
      customizationId: '{customization_id}',
      word: 'ACLs',
      translation: 'ackles',
    };
    
    textToSpeech.addWord(addWordParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.add_word(
        '{customization_id}',
        'ACLs',
        'ackles'
    )
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.add_word(
        '{customization_id}',
        'ACLs',
        'ackles'
    )

Response

Response type: object

Status Code

  • OK. The word was successfully added to the custom model.

  • Bad request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. If the request fails SSML validation, the description of the error explains the failure; for more information, see SSML validation. Specific messages include

    • Invalid parameter '{name}' in request
    • Invalid value for 'customization_id'
    • Required parameter 'translation' is missing
    • <phoneme alphabet="{alphabet}" ph="{translation}"></phoneme> is not a standard SSML format
    • In SSML: <phoneme alphabet="ipa" ph="{translation}"></phoneme>, attribute 'ph' is not a standard IPA format
    • In SSML: <phoneme alphabet="ibm" ph="{translation}"></phoneme>, attribute 'ph' is not a standard SPR format
    • Invalid part_of_speech name
    • Part of speech is supported for ja-JP language only
    • Invalid header value for '{header}'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

Get a custom word

Gets the translation for a single word from the specified custom model. The output shows the translation as it is defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying a single word from a custom model.

Gets the translation for a single word from the specified custom model. The output shows the translation as it is defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying a single word from a custom model.

Gets the translation for a single word from the specified custom model. The output shows the translation as it is defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying a single word from a custom model.

Gets the translation for a single word from the specified custom model. The output shows the translation as it is defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying a single word from a custom model.

Gets the translation for a single word from the specified custom model. The output shows the translation as it is defined in the model. You must use credentials for the instance of the service that owns a model to list its words.

See also: Querying a single word from a custom model.

GET /v1/customizations/{customization_id}/words/{word}
GetWord(string customizationId, string word)
ServiceCall<Translation> getWord(GetWordOptions getWordOptions)
getWord(params)
get_word(
        self,
        customization_id: str,
        word: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the GetWordOptions.Builder to create a GetWordOptions object that contains the parameter values for the getWord method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be queried from the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be queried from the custom model.

The getWord options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be queried from the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be queried from the custom model.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/words/ACLs"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/words/ACLs"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetWord(
        customizationId: "{customizationId}",
        word: "ACLs"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetWord(
        customizationId: "{customizationId}",
        word: "ACLs"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetWordOptions getWordOptions = new GetWordOptions.Builder()
      .customizationId("{customizationId}")
      .word("ACLs")
      .build();
    
    Translation translation =
      textToSpeech.getWord(getWordOptions).execute().getResult();
    System.out.println(translation);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetWordOptions getWordOptions = new GetWordOptions.Builder()
      .customizationId("{customizationId}")
      .word("ACLs")
      .build();
    
    Translation translation =
      textToSpeech.getWord(getWordOptions).execute().getResult();
    System.out.println(translation);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const getWordParams = {
      customizationId: '{customization_id}',
      word: 'ACLs',
    };
    
    textToSpeech.getWord(getWordParams)
      .then(translation => {
        console.log(JSON.stringify(translation, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const getWordParams = {
      customizationId: '{customization_id}',
      word: 'ACLs',
    };
    
    textToSpeech.getWord(getWordParams)
      .then(translation => {
        console.log(JSON.stringify(translation, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    word = text_to_speech.get_word(
        '{customization_id}',
        'ACLs'
    ).get_result()
    print(json.dumps(word, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    word = text_to_speech.get_word(
        '{customization_id}',
        'ACLs'
    ).get_result()
    print(json.dumps(word, indent=2))

Response

Information about the translation for the specified text.

Information about the translation for the specified text.

Information about the translation for the specified text.

Information about the translation for the specified text.

Information about the translation for the specified text.

Status Code

  • OK. The request succeeded.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'customization_id'
    • Word: {word} not found in customization_id: {customization_id}
    • Invalid header value for '{header}'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "translation": "ackles"
    }
  • {
      "translation": "ackles"
    }

Delete a custom word

Deletes a single word from the specified custom model. You must use credentials for the instance of the service that owns a model to delete its words.

See also: Deleting a word from a custom model.

Deletes a single word from the specified custom model. You must use credentials for the instance of the service that owns a model to delete its words.

See also: Deleting a word from a custom model.

Deletes a single word from the specified custom model. You must use credentials for the instance of the service that owns a model to delete its words.

See also: Deleting a word from a custom model.

Deletes a single word from the specified custom model. You must use credentials for the instance of the service that owns a model to delete its words.

See also: Deleting a word from a custom model.

Deletes a single word from the specified custom model. You must use credentials for the instance of the service that owns a model to delete its words.

See also: Deleting a word from a custom model.

DELETE /v1/customizations/{customization_id}/words/{word}
DeleteWord(string customizationId, string word)
ServiceCall<Void> deleteWord(DeleteWordOptions deleteWordOptions)
deleteWord(params)
delete_word(
        self,
        customization_id: str,
        word: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the DeleteWordOptions.Builder to create a DeleteWordOptions object that contains the parameter values for the deleteWord method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be deleted from the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be deleted from the custom model.

The deleteWord options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be deleted from the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The word that is to be deleted from the custom model.

  • curl -X DELETE -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/words/ACLs"
  • curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/words/ACLs"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteWord(
        customizationId: "{customizationId}",
        word: "ACLs"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteWord(
        customizationId: "{customizationId}",
        word: "ACLs"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteWordOptions deleteWordOptions = new DeleteWordOptions.Builder()
      .customizationId("{customizationId}")
      .word("ACLs")
      .build();
    
    textToSpeech.deleteWord(deleteWordOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteWordOptions deleteWordOptions = new DeleteWordOptions.Builder()
      .customizationId("{customizationId}")
      .word("ACLs")
      .build();
    
    textToSpeech.deleteWord(deleteWordOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteWordParams = {
      customizationId: '{customization_id}',
      word: 'ACLs',
    };
    
    textToSpeech.deleteWord(deleteWordParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteWordParams = {
      customizationId: '{customization_id}',
      word: 'ACLs',
    };
    
    textToSpeech.deleteWord(deleteWordParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_word(
        '{customization_id}',
        'ACLs'
    )
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_word(
        '{customization_id}',
        'ACLs'
    )

Response

Response type: object

Status Code

  • No Content. The word was successfully deleted from the custom model.

  • Bad Request. A required input parameter is null or a specified input parameter or header value is invalid or not supported. Specific messages include

    • Invalid value for 'customization_id'
    • Word: {word} not found in customization_id: {customization_id}
    • Invalid header value for '{header}'
  • Unauthorized. The specified customization_id is invalid for the requesting credentials:

    • Invalid customization_id ('{id}') for user
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

List custom prompts

Beta

Lists information about all custom prompts that are defined for a custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. The same information about all of the prompts for a custom model is also provided by the Get a custom model method. That method provides complete details about a specified custom model, including its language, owner, custom words, and more. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Lists information about all custom prompts that are defined for a custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. The same information about all of the prompts for a custom model is also provided by the Get a custom model method. That method provides complete details about a specified custom model, including its language, owner, custom words, and more. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Lists information about all custom prompts that are defined for a custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. The same information about all of the prompts for a custom model is also provided by the Get a custom model method. That method provides complete details about a specified custom model, including its language, owner, custom words, and more. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Lists information about all custom prompts that are defined for a custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. The same information about all of the prompts for a custom model is also provided by the Get a custom model method. That method provides complete details about a specified custom model, including its language, owner, custom words, and more. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Lists information about all custom prompts that are defined for a custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. The same information about all of the prompts for a custom model is also provided by the Get a custom model method. That method provides complete details about a specified custom model, including its language, owner, custom words, and more. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

GET /v1/customizations/{customization_id}/prompts
ListCustomPrompts(string customizationId)
ServiceCall<Prompts> listCustomPrompts(ListCustomPromptsOptions listCustomPromptsOptions)
listCustomPrompts(params)
list_custom_prompts(
        self,
        customization_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the ListCustomPromptsOptions.Builder to create a ListCustomPromptsOptions object that contains the parameter values for the listCustomPrompts method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

The listCustomPrompts options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/prompts"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/prompts"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListCustomPrompts(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListCustomPrompts(
        customizationId: "{customizationId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    ListCustomPromptsOptions listCustomPromptsOptions =
      new ListCustomPromptsOptions.Builder()
        .customizationId("{customizationId}")
        .build();
    
    Prompts prompts =
      textToSpeech.listCustomPrompts(listCustomPromptsOptions).execute().getResult();
    System.out.println(prompts);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    ListCustomPromptsOptions listCustomPromptsOptions =
      new ListCustomPromptsOptions.Builder()
        .customizationId("{customizationId}")
        .build();
    
    Prompts prompts =
      textToSpeech.listCustomPrompts(listCustomPromptsOptions).execute().getResult();
    System.out.println(prompts);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const listCustomPromptsParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.listCustomPrompts(listCustomPromptsParams)
      .then(prompts => {
        console.log(JSON.stringify(prompts, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const listCustomPromptsParams = {
      customizationId: '{customization_id}',
    };
    
    textToSpeech.listCustomPrompts(listCustomPromptsParams)
      .then(prompts => {
        console.log(JSON.stringify(prompts, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    prompts = text_to_speech.list_custom_prompts('{customization_id}').get_result()
    print(json.dumps(prompts, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    prompts = text_to_speech.list_custom_prompts('{customization_id}').get_result()
    print(json.dumps(prompts, indent=2))

Response

Information about the custom prompts that are defined for a custom model.

Information about the custom prompts that are defined for a custom model.

Information about the custom prompts that are defined for a custom model.

Information about the custom prompts that are defined for a custom model.

Information about the custom prompts that are defined for a custom model.

Status Code

  • OK. The request succeeded.

  • Bad Request. The request failed. Possible failure causes include:

    • Invalid service credentials were passed with the request.
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "prompts": [
        {
          "prompt": "Hello and welcome!",
          "prompt_id": "greeting",
          "status": "available",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        },
        {
          "prompt": "How can I help you today?",
          "prompt_id": "help",
          "status": "processing",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        },
        {
          "prompt": "I am sorry to hear that.",
          "prompt_id": "sorry",
          "status": "available",
          "speaker_id": "323e4476-63de-9825-7cd7-8120e45f8331"
        }
      ]
    }
  • {
      "prompts": [
        {
          "prompt": "Hello and welcome!",
          "prompt_id": "greeting",
          "status": "available",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        },
        {
          "prompt": "How can I help you today?",
          "prompt_id": "help",
          "status": "processing",
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
        },
        {
          "prompt": "I am sorry to hear that.",
          "prompt_id": "sorry",
          "status": "available",
          "speaker_id": "323e4476-63de-9825-7cd7-8120e45f8331"
        }
      ]
    }

Add a custom prompt

Beta

Adds a custom prompt to a custom model. A prompt is defined by the text that is to be spoken, the audio for that text, a unique user-specified ID for the prompt, and an optional speaker ID. The information is used to generate prosodic data that is not visible to the user. This data is used by the service to produce the synthesized audio upon request. You must use credentials for the instance of the service that owns a custom model to add a prompt to it. You can add a maximum of 1000 custom prompts to a single custom model.

You are recommended to assign meaningful values for prompt IDs. For example, use goodbye to identify a prompt that speaks a farewell message. Prompt IDs must be unique within a given custom model. You cannot define two prompts with the same name for the same custom model. If you provide the ID of an existing prompt, the previously uploaded prompt is replaced by the new information. The existing prompt is reprocessed by using the new text and audio and, if provided, new speaker model, and the prosody data associated with the prompt is updated.

The quality of a prompt is undefined if the language of a prompt does not match the language of its custom model. This is consistent with any text or SSML that is specified for a speech synthesis request. The service makes a best-effort attempt to render the specified text for the prompt; it does not validate that the language of the text matches the language of the model.

Adding a prompt is an asynchronous operation. Although it accepts less audio than speaker enrollment, the service must align the audio with the provided text. The time that it takes to process a prompt depends on the prompt itself. The processing time for a reasonably sized prompt generally matches the length of the audio (for example, it takes 20 seconds to process a 20-second prompt).

For shorter prompts, you can wait for a reasonable amount of time and then check the status of the prompt with the Get a custom prompt method. For longer prompts, consider using that method to poll the service every few seconds to determine when the prompt becomes available. No prompt can be used for speech synthesis if it is in the processing or failed state. Only prompts that are in the available state can be used for speech synthesis.

When it processes a request, the service attempts to align the text and the audio that are provided for the prompt. The text that is passed with a prompt must match the spoken audio as closely as possible. Optimally, the text and audio match exactly. The service does its best to align the specified text with the audio, and it can often compensate for mismatches between the two. But if the service cannot effectively align the text and the audio, possibly because the magnitude of mismatches between the two is too great, processing of the prompt fails.

Evaluating a prompt

Always listen to and evaluate a prompt to determine its quality before using it in production. To evaluate a prompt, include only the single prompt in a speech synthesis request by using the following SSML extension, in this case for a prompt whose ID is goodbye:

<ibm:prompt id="goodbye"/>

In some cases, you might need to rerecord and resubmit a prompt as many as five times to address the following possible problems:

  • The service might fail to detect a mismatch between the prompt’s text and audio. The longer the prompt, the greater the chance for misalignment between its text and audio. Therefore, multiple shorter prompts are preferable to a single long prompt.
  • The text of a prompt might include a word that the service does not recognize. In this case, you can create a custom word and pronunciation pair to tell the service how to pronounce the word. You must then re-create the prompt.
  • The quality of the input audio might be insufficient or the service’s processing of the audio might fail to detect the intended prosody. Submitting new audio for the prompt can correct these issues.

If a prompt that is created without a speaker ID does not adequately reflect the intended prosody, enrolling the speaker and providing a speaker ID for the prompt is one recommended means of potentially improving the quality of the prompt. This is especially important for shorter prompts such as "good-bye" or "thank you," where less audio data makes it more difficult to match the prosody of the speaker. Custom prompts are supported only for use with US English custom models and voices.

See also:

Adds a custom prompt to a custom model. A prompt is defined by the text that is to be spoken, the audio for that text, a unique user-specified ID for the prompt, and an optional speaker ID. The information is used to generate prosodic data that is not visible to the user. This data is used by the service to produce the synthesized audio upon request. You must use credentials for the instance of the service that owns a custom model to add a prompt to it. You can add a maximum of 1000 custom prompts to a single custom model.

You are recommended to assign meaningful values for prompt IDs. For example, use goodbye to identify a prompt that speaks a farewell message. Prompt IDs must be unique within a given custom model. You cannot define two prompts with the same name for the same custom model. If you provide the ID of an existing prompt, the previously uploaded prompt is replaced by the new information. The existing prompt is reprocessed by using the new text and audio and, if provided, new speaker model, and the prosody data associated with the prompt is updated.

The quality of a prompt is undefined if the language of a prompt does not match the language of its custom model. This is consistent with any text or SSML that is specified for a speech synthesis request. The service makes a best-effort attempt to render the specified text for the prompt; it does not validate that the language of the text matches the language of the model.

Adding a prompt is an asynchronous operation. Although it accepts less audio than speaker enrollment, the service must align the audio with the provided text. The time that it takes to process a prompt depends on the prompt itself. The processing time for a reasonably sized prompt generally matches the length of the audio (for example, it takes 20 seconds to process a 20-second prompt).

For shorter prompts, you can wait for a reasonable amount of time and then check the status of the prompt with the Get a custom prompt method. For longer prompts, consider using that method to poll the service every few seconds to determine when the prompt becomes available. No prompt can be used for speech synthesis if it is in the processing or failed state. Only prompts that are in the available state can be used for speech synthesis.

When it processes a request, the service attempts to align the text and the audio that are provided for the prompt. The text that is passed with a prompt must match the spoken audio as closely as possible. Optimally, the text and audio match exactly. The service does its best to align the specified text with the audio, and it can often compensate for mismatches between the two. But if the service cannot effectively align the text and the audio, possibly because the magnitude of mismatches between the two is too great, processing of the prompt fails.

Evaluating a prompt

Always listen to and evaluate a prompt to determine its quality before using it in production. To evaluate a prompt, include only the single prompt in a speech synthesis request by using the following SSML extension, in this case for a prompt whose ID is goodbye:

<ibm:prompt id="goodbye"/>

In some cases, you might need to rerecord and resubmit a prompt as many as five times to address the following possible problems:

  • The service might fail to detect a mismatch between the prompt’s text and audio. The longer the prompt, the greater the chance for misalignment between its text and audio. Therefore, multiple shorter prompts are preferable to a single long prompt.
  • The text of a prompt might include a word that the service does not recognize. In this case, you can create a custom word and pronunciation pair to tell the service how to pronounce the word. You must then re-create the prompt.
  • The quality of the input audio might be insufficient or the service’s processing of the audio might fail to detect the intended prosody. Submitting new audio for the prompt can correct these issues.

If a prompt that is created without a speaker ID does not adequately reflect the intended prosody, enrolling the speaker and providing a speaker ID for the prompt is one recommended means of potentially improving the quality of the prompt. This is especially important for shorter prompts such as "good-bye" or "thank you," where less audio data makes it more difficult to match the prosody of the speaker. Custom prompts are supported only for use with US English custom models and voices.

See also:

Adds a custom prompt to a custom model. A prompt is defined by the text that is to be spoken, the audio for that text, a unique user-specified ID for the prompt, and an optional speaker ID. The information is used to generate prosodic data that is not visible to the user. This data is used by the service to produce the synthesized audio upon request. You must use credentials for the instance of the service that owns a custom model to add a prompt to it. You can add a maximum of 1000 custom prompts to a single custom model.

You are recommended to assign meaningful values for prompt IDs. For example, use goodbye to identify a prompt that speaks a farewell message. Prompt IDs must be unique within a given custom model. You cannot define two prompts with the same name for the same custom model. If you provide the ID of an existing prompt, the previously uploaded prompt is replaced by the new information. The existing prompt is reprocessed by using the new text and audio and, if provided, new speaker model, and the prosody data associated with the prompt is updated.

The quality of a prompt is undefined if the language of a prompt does not match the language of its custom model. This is consistent with any text or SSML that is specified for a speech synthesis request. The service makes a best-effort attempt to render the specified text for the prompt; it does not validate that the language of the text matches the language of the model.

Adding a prompt is an asynchronous operation. Although it accepts less audio than speaker enrollment, the service must align the audio with the provided text. The time that it takes to process a prompt depends on the prompt itself. The processing time for a reasonably sized prompt generally matches the length of the audio (for example, it takes 20 seconds to process a 20-second prompt).

For shorter prompts, you can wait for a reasonable amount of time and then check the status of the prompt with the Get a custom prompt method. For longer prompts, consider using that method to poll the service every few seconds to determine when the prompt becomes available. No prompt can be used for speech synthesis if it is in the processing or failed state. Only prompts that are in the available state can be used for speech synthesis.

When it processes a request, the service attempts to align the text and the audio that are provided for the prompt. The text that is passed with a prompt must match the spoken audio as closely as possible. Optimally, the text and audio match exactly. The service does its best to align the specified text with the audio, and it can often compensate for mismatches between the two. But if the service cannot effectively align the text and the audio, possibly because the magnitude of mismatches between the two is too great, processing of the prompt fails.

Evaluating a prompt

Always listen to and evaluate a prompt to determine its quality before using it in production. To evaluate a prompt, include only the single prompt in a speech synthesis request by using the following SSML extension, in this case for a prompt whose ID is goodbye:

<ibm:prompt id="goodbye"/>

In some cases, you might need to rerecord and resubmit a prompt as many as five times to address the following possible problems:

  • The service might fail to detect a mismatch between the prompt’s text and audio. The longer the prompt, the greater the chance for misalignment between its text and audio. Therefore, multiple shorter prompts are preferable to a single long prompt.
  • The text of a prompt might include a word that the service does not recognize. In this case, you can create a custom word and pronunciation pair to tell the service how to pronounce the word. You must then re-create the prompt.
  • The quality of the input audio might be insufficient or the service’s processing of the audio might fail to detect the intended prosody. Submitting new audio for the prompt can correct these issues.

If a prompt that is created without a speaker ID does not adequately reflect the intended prosody, enrolling the speaker and providing a speaker ID for the prompt is one recommended means of potentially improving the quality of the prompt. This is especially important for shorter prompts such as "good-bye" or "thank you," where less audio data makes it more difficult to match the prosody of the speaker. Custom prompts are supported only for use with US English custom models and voices.

See also:

Adds a custom prompt to a custom model. A prompt is defined by the text that is to be spoken, the audio for that text, a unique user-specified ID for the prompt, and an optional speaker ID. The information is used to generate prosodic data that is not visible to the user. This data is used by the service to produce the synthesized audio upon request. You must use credentials for the instance of the service that owns a custom model to add a prompt to it. You can add a maximum of 1000 custom prompts to a single custom model.

You are recommended to assign meaningful values for prompt IDs. For example, use goodbye to identify a prompt that speaks a farewell message. Prompt IDs must be unique within a given custom model. You cannot define two prompts with the same name for the same custom model. If you provide the ID of an existing prompt, the previously uploaded prompt is replaced by the new information. The existing prompt is reprocessed by using the new text and audio and, if provided, new speaker model, and the prosody data associated with the prompt is updated.

The quality of a prompt is undefined if the language of a prompt does not match the language of its custom model. This is consistent with any text or SSML that is specified for a speech synthesis request. The service makes a best-effort attempt to render the specified text for the prompt; it does not validate that the language of the text matches the language of the model.

Adding a prompt is an asynchronous operation. Although it accepts less audio than speaker enrollment, the service must align the audio with the provided text. The time that it takes to process a prompt depends on the prompt itself. The processing time for a reasonably sized prompt generally matches the length of the audio (for example, it takes 20 seconds to process a 20-second prompt).

For shorter prompts, you can wait for a reasonable amount of time and then check the status of the prompt with the Get a custom prompt method. For longer prompts, consider using that method to poll the service every few seconds to determine when the prompt becomes available. No prompt can be used for speech synthesis if it is in the processing or failed state. Only prompts that are in the available state can be used for speech synthesis.

When it processes a request, the service attempts to align the text and the audio that are provided for the prompt. The text that is passed with a prompt must match the spoken audio as closely as possible. Optimally, the text and audio match exactly. The service does its best to align the specified text with the audio, and it can often compensate for mismatches between the two. But if the service cannot effectively align the text and the audio, possibly because the magnitude of mismatches between the two is too great, processing of the prompt fails.

Evaluating a prompt

Always listen to and evaluate a prompt to determine its quality before using it in production. To evaluate a prompt, include only the single prompt in a speech synthesis request by using the following SSML extension, in this case for a prompt whose ID is goodbye:

<ibm:prompt id="goodbye"/>

In some cases, you might need to rerecord and resubmit a prompt as many as five times to address the following possible problems:

  • The service might fail to detect a mismatch between the prompt’s text and audio. The longer the prompt, the greater the chance for misalignment between its text and audio. Therefore, multiple shorter prompts are preferable to a single long prompt.
  • The text of a prompt might include a word that the service does not recognize. In this case, you can create a custom word and pronunciation pair to tell the service how to pronounce the word. You must then re-create the prompt.
  • The quality of the input audio might be insufficient or the service’s processing of the audio might fail to detect the intended prosody. Submitting new audio for the prompt can correct these issues.

If a prompt that is created without a speaker ID does not adequately reflect the intended prosody, enrolling the speaker and providing a speaker ID for the prompt is one recommended means of potentially improving the quality of the prompt. This is especially important for shorter prompts such as "good-bye" or "thank you," where less audio data makes it more difficult to match the prosody of the speaker. Custom prompts are supported only for use with US English custom models and voices.

See also:

Adds a custom prompt to a custom model. A prompt is defined by the text that is to be spoken, the audio for that text, a unique user-specified ID for the prompt, and an optional speaker ID. The information is used to generate prosodic data that is not visible to the user. This data is used by the service to produce the synthesized audio upon request. You must use credentials for the instance of the service that owns a custom model to add a prompt to it. You can add a maximum of 1000 custom prompts to a single custom model.

You are recommended to assign meaningful values for prompt IDs. For example, use goodbye to identify a prompt that speaks a farewell message. Prompt IDs must be unique within a given custom model. You cannot define two prompts with the same name for the same custom model. If you provide the ID of an existing prompt, the previously uploaded prompt is replaced by the new information. The existing prompt is reprocessed by using the new text and audio and, if provided, new speaker model, and the prosody data associated with the prompt is updated.

The quality of a prompt is undefined if the language of a prompt does not match the language of its custom model. This is consistent with any text or SSML that is specified for a speech synthesis request. The service makes a best-effort attempt to render the specified text for the prompt; it does not validate that the language of the text matches the language of the model.

Adding a prompt is an asynchronous operation. Although it accepts less audio than speaker enrollment, the service must align the audio with the provided text. The time that it takes to process a prompt depends on the prompt itself. The processing time for a reasonably sized prompt generally matches the length of the audio (for example, it takes 20 seconds to process a 20-second prompt).

For shorter prompts, you can wait for a reasonable amount of time and then check the status of the prompt with the Get a custom prompt method. For longer prompts, consider using that method to poll the service every few seconds to determine when the prompt becomes available. No prompt can be used for speech synthesis if it is in the processing or failed state. Only prompts that are in the available state can be used for speech synthesis.

When it processes a request, the service attempts to align the text and the audio that are provided for the prompt. The text that is passed with a prompt must match the spoken audio as closely as possible. Optimally, the text and audio match exactly. The service does its best to align the specified text with the audio, and it can often compensate for mismatches between the two. But if the service cannot effectively align the text and the audio, possibly because the magnitude of mismatches between the two is too great, processing of the prompt fails.

Evaluating a prompt

Always listen to and evaluate a prompt to determine its quality before using it in production. To evaluate a prompt, include only the single prompt in a speech synthesis request by using the following SSML extension, in this case for a prompt whose ID is goodbye:

<ibm:prompt id="goodbye"/>

In some cases, you might need to rerecord and resubmit a prompt as many as five times to address the following possible problems:

  • The service might fail to detect a mismatch between the prompt’s text and audio. The longer the prompt, the greater the chance for misalignment between its text and audio. Therefore, multiple shorter prompts are preferable to a single long prompt.
  • The text of a prompt might include a word that the service does not recognize. In this case, you can create a custom word and pronunciation pair to tell the service how to pronounce the word. You must then re-create the prompt.
  • The quality of the input audio might be insufficient or the service’s processing of the audio might fail to detect the intended prosody. Submitting new audio for the prompt can correct these issues.

If a prompt that is created without a speaker ID does not adequately reflect the intended prosody, enrolling the speaker and providing a speaker ID for the prompt is one recommended means of potentially improving the quality of the prompt. This is especially important for shorter prompts such as "good-bye" or "thank you," where less audio data makes it more difficult to match the prosody of the speaker. Custom prompts are supported only for use with US English custom models and voices.

See also:

POST /v1/customizations/{customization_id}/prompts/{prompt_id}
AddCustomPrompt(string customizationId, string promptId, PromptMetadata metadata, System.IO.MemoryStream file)
ServiceCall<Prompt> addCustomPrompt(AddCustomPromptOptions addCustomPromptOptions)
addCustomPrompt(params)
add_custom_prompt(
        self,
        customization_id: str,
        prompt_id: str,
        metadata: 'PromptMetadata',
        file: BinaryIO,
        **kwargs,
    ) -> DetailedResponse

Request

Use the AddCustomPromptOptions.Builder to create a AddCustomPromptOptions object that contains the parameter values for the addCustomPrompt method.

Custom Headers

  • The type of the input, which must be multipart/form-data.

    Allowable values: [multipart/form-data]

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier of the prompt that is to be added to the custom model:

    • Include a maximum of 49 characters in the ID.
    • Include only alphanumeric characters and _ (underscores) in the ID.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the ID.
    • To add a new prompt, the ID must be unique for the specified custom model. Otherwise, the new information for the prompt overwrites the existing prompt that has that ID.

Form Parameters

  • Information about the prompt that is to be added to a custom model. The following example of a PromptMetadata object includes both the required prompt text and an optional speaker model ID:

    { "prompt_text": "Thank you and good-bye!", "speaker_id": "823068b2-ed4e-11ea-b6e0-7b6456aa95cc" }

  • An audio file that speaks the text of the prompt with intonation and prosody that matches how you would like the prompt to be spoken.

    • The prompt audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. The service transcodes all audio to 16 kHz before processing it.
    • The length of the prompt audio is limited to 30 seconds.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier of the prompt that is to be added to the custom model:

    • Include a maximum of 49 characters in the ID.
    • Include only alphanumeric characters and _ (underscores) in the ID.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the ID.
    • To add a new prompt, the ID must be unique for the specified custom model. Otherwise, the new information for the prompt overwrites the existing prompt that has that ID.
  • Information about the prompt that is to be added to a custom model. The following example of a PromptMetadata object includes both the required prompt text and an optional speaker model ID:

    { "prompt_text": "Thank you and good-bye!", "speaker_id": "823068b2-ed4e-11ea-b6e0-7b6456aa95cc" }.

  • An audio file that speaks the text of the prompt with intonation and prosody that matches how you would like the prompt to be spoken.

    • The prompt audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. The service transcodes all audio to 16 kHz before processing it.
    • The length of the prompt audio is limited to 30 seconds.

The addCustomPrompt options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier of the prompt that is to be added to the custom model:

    • Include a maximum of 49 characters in the ID.
    • Include only alphanumeric characters and _ (underscores) in the ID.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the ID.
    • To add a new prompt, the ID must be unique for the specified custom model. Otherwise, the new information for the prompt overwrites the existing prompt that has that ID.
  • Information about the prompt that is to be added to a custom model. The following example of a PromptMetadata object includes both the required prompt text and an optional speaker model ID:

    { "prompt_text": "Thank you and good-bye!", "speaker_id": "823068b2-ed4e-11ea-b6e0-7b6456aa95cc" }.

  • An audio file that speaks the text of the prompt with intonation and prosody that matches how you would like the prompt to be spoken.

    • The prompt audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. The service transcodes all audio to 16 kHz before processing it.
    • The length of the prompt audio is limited to 30 seconds.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier of the prompt that is to be added to the custom model:

    • Include a maximum of 49 characters in the ID.
    • Include only alphanumeric characters and _ (underscores) in the ID.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the ID.
    • To add a new prompt, the ID must be unique for the specified custom model. Otherwise, the new information for the prompt overwrites the existing prompt that has that ID.
  • Information about the prompt that is to be added to a custom model. The following example of a PromptMetadata object includes both the required prompt text and an optional speaker model ID:

    { "prompt_text": "Thank you and good-bye!", "speaker_id": "823068b2-ed4e-11ea-b6e0-7b6456aa95cc" }.

  • An audio file that speaks the text of the prompt with intonation and prosody that matches how you would like the prompt to be spoken.

    • The prompt audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. The service transcodes all audio to 16 kHz before processing it.
    • The length of the prompt audio is limited to 30 seconds.
  • curl -X POST -u "apikey:{apikey}" --header "Content-Type:multipart/form-data" --form metadata="{\"prompt_text\": \"Thank you and good-bye!\", \"speaker_id\": \"{speaker_id}\"}" --form file=@goodbye-prompt.wav "{url}/v1/customizations/{customization_id}/prompts/goodbye"
  • curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type:multipart/form-data" --form metadata="{\"prompt_text\": \"Thank you and good-bye!\", \"speaker_id\": \"{speaker_id}\"}" --form file=@goodbye-prompt.wav "{url}/v1/customizations/{customization_id}/prompts/goodbye"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var promptMetadata = new PromptMetadata()
    {
        PromptText = "Thank you and good-bye!",
        SpeakerId = "{speakerId}"
    };
    
    var result = textToSpeech.AddCustomPrompt(
        customizationId: "{customizationId}",
        promptId: "goodbye",
        metadata: promptMetadata,
        file: new MemoryStream(File.ReadAllBytes("goodbye-prompt.wav"))
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var promptMetadata = new PromptMetadata()
    {
        PromptText = "Thank you and good-bye!",
        SpeakerId = "{speakerId}"
    };
    
    var result = textToSpeech.AddCustomPrompt(
        customizationId: "{customizationId}",
        promptId: "goodbye",
        metadata: promptMetadata,
        file: new MemoryStream(File.ReadAllBytes("goodbye-prompt.wav"))
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    PromptMetadata promptMetadata = new PromptMetadataBuilder()
      .promptText("Thank you and good-bye!")
      .speakerId("{speakerId}")
      .build()
    
    try {
      AddCustomPromptOptions addCustomPromptOptions =
        new AddCustomPromptOptions.Builder()
          .customizationId("{customizationId}")
          .promptID("goodbye")
          .metadata(promptMetadata)
          .file(new File("goodbye-prompt.wav"))
          .build();
    
      Prompt prompt = textToSpeech.addCustomPrompt(addCustomPromptOptions).execute();
      System.out.println(prompt);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    PromptMetadata promptMetadata = new PromptMetadataBuilder()
      .promptText("Thank you and good-bye!")
      .speakerId("{speakerId}")
      .build()
    
    try {
      AddCustomPromptOptions addCustomPromptOptions =
        new AddCustomPromptOptions.Builder()
          .customizationId("{customizationId}")
          .promptID("goodbye")
          .metadata(promptMetadata)
          .file(new File("goodbye-prompt.wav"))
          .build();
    
      Prompt prompt = textToSpeech.addCustomPrompt(addCustomPromptOptions).execute();
      System.out.println(prompt);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  • const fs = require('fs');
    const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const addCustomPromptParams = {
      customizationId: '{customization_id}',
      promptId: 'goodbye',
      metadata: {
        'prompt_text': 'Thank you and good-bye!',
        'speaker_id': '{speaker_id}',
      },
      file: fs.createReadStream('./goodbye-prompt.wav'),
    };
    
    textToSpeech.addCustomPrompt(addCustomPromptParams)
      .then(prompt => {
        console.log(JSON.stringify(prompt, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const fs = require('fs');
    const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const addCustomPromptParams = {
      customizationId: '{customization_id}',
      promptId: 'goodbye',
      metadata: {
        'prompt_text': 'Thank you and good-bye!',
        'speaker_id': '{speaker_id}',
      },
      file: fs.createReadStream('./goodbye-prompt.wav'),
    };
    
    textToSpeech.addCustomPrompt(addCustomPromptParams)
      .then(prompt => {
        console.log(JSON.stringify(prompt, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from os.path import join, dirname
    import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    with open(join(dirname(__file__), './.', 'goodbye-prompt.wav'),
                   'rb') as audio_file:
        prompt=text_to_speech.add_custom_prompt(
            '{customization_id}',
            'goodbye',
            {
                'prompt_text': 'Thank you and good-bye!',
                'speaker_id': '{speaker_id}'
            },
            audio_file
        ).get_result()
        print(json.dumps(prompt, indent=2))
  • from os.path import join, dirname
    import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    with open(join(dirname(__file__), './.', 'goodbye-prompt.wav'),
                   'rb') as audio_file:
        prompt=text_to_speech.add_custom_prompt(
            '{customization_id}',
            'goodbye',
            {
                'prompt_text': 'Thank you and good-bye!',
                'speaker_id': '{speaker_id}'
            },
            audio_file
        ).get_result()
        print(json.dumps(prompt, indent=2))

Response

Information about a custom prompt.

Information about a custom prompt.

Information about a custom prompt.

Information about a custom prompt.

Information about a custom prompt.

Status Code

  • Created. The prompt was added successfully. Check the status of the prompt to ensure that it is available for use in speech synthesis.

  • Bad Request. The request failed. Possible failure causes include:

    • The prompt name exceeds the 49-character limit or includes characters that are not alphanumeric or underscores.
    • The audio has a media type other than audio/wav or a sampling rate of less than 16 kHz.
    • The audio is longer than 30 seconds.
    • The service cannot process the audio for any reason (for example, the audio is corrupt).
    • The service cannot align the text and the audio because differences between the two are too great.
    • The request attempts to add a prompt to a custom model that is defined for a language other than US English.
    • Invalid service credentials were passed with the request.
  • Unauthorized. The specified customization_id is invalid for the requesting credentials.

  • Unsupported Media Type. The request passed an unacceptable media type with the Content-Type header. The header must pass a value of multipart/form-data.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "prompt": "Thank you and good-bye!",
      "prompt_id": "goodbye",
      "status": "processing",
      "speaker_id": "823068b2-ed4e-11ea-b6e0-7b6456aa95cc"
    }
  • {
      "prompt": "Thank you and good-bye!",
      "prompt_id": "goodbye",
      "status": "processing",
      "speaker_id": "823068b2-ed4e-11ea-b6e0-7b6456aa95cc"
    }

Get a custom prompt

Beta

Gets information about a specified custom prompt for a specified custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Gets information about a specified custom prompt for a specified custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Gets information about a specified custom prompt for a specified custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Gets information about a specified custom prompt for a specified custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

Gets information about a specified custom prompt for a specified custom model. The information includes the prompt ID, prompt text, status, and optional speaker ID for each prompt of the custom model. You must use credentials for the instance of the service that owns the custom model. Custom prompts are supported only for use with US English custom models and voices.

See also: Listing custom prompts.

GET /v1/customizations/{customization_id}/prompts/{prompt_id}
GetCustomPrompt(string customizationId, string promptId)
ServiceCall<Prompt> getCustomPrompt(GetCustomPromptOptions getCustomPromptOptions)
getCustomPrompt(params)
get_custom_prompt(
        self,
        customization_id: str,
        prompt_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the GetCustomPromptOptions.Builder to create a GetCustomPromptOptions object that contains the parameter values for the getCustomPrompt method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt.

The getCustomPrompt options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/prompts/{prompt_id}"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/prompts/{prompt_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetCustomPrompt(
        customizationId: "{customizationId}",
        promptId: "{promptId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetCustomPrompt(
        customizationId: "{customizationId}",
        promptId: "{promptId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetCustomPromptOptions getCustomPromptOptions =
      new GetCustomPromptOptions.Builder()
        .customizationId("{customizationId}")
        .promptId("{promptId}")
        .build();
    
    Prompt prompt =
      textToSpeech.getCustomPrompt(getCustomPromptOptions).execute().getResult();
    System.out.println(prompt);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetCustomPromptOptions getCustomPromptOptions =
      new GetCustomPromptOptions.Builder()
        .customizationId("{customizationId}")
        .promptId("{promptId}")
        .build();
    
    Prompt prompt =
      textToSpeech.getCustomPrompt(getCustomPromptOptions).execute().getResult();
    System.out.println(prompt);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const getCustomPromptParams = {
      customizationId: '{customization_id}',
      promptId: '{prompt_id}',
    };
    
    textToSpeech.getCustomPrompt(getCustomPromptParams)
      .then(prompt => {
        console.log(JSON.stringify(prompt, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const getCustomPromptParams = {
      customizationId: '{customization_id}',
      promptId: '{prompt_id}',
    };
    
    textToSpeech.getCustomPrompt(getCustomPromptParams)
      .then(prompt => {
        console.log(JSON.stringify(prompt, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    prompt = text_to_speech.get_custom_prompt(
        '{customization_id}',
        '{prompt_id}'
    ).get_result()
    print(json.dumps(prompt, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    prompt = text_to_speech.get_custom_prompt(
        '{customization_id}',
        '{prompt_id}'
    ).get_result()
    print(json.dumps(prompt, indent=2))

Response

Information about a custom prompt.

Information about a custom prompt.

Information about a custom prompt.

Information about a custom prompt.

Information about a custom prompt.

Status Code

  • OK. The request succeeded.

  • Bad Request. The request failed. Possible failure causes include:

    • Invalid service credentials were passed with the request.
  • Unauthorized. The request failed. Possible failure causes include:

    • The specified customization_id is invalid for the requesting credentials.
    • The specified prompt_id is invalid for the requesting credentials or for the specified custom model.
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "prompt": "Hello and welcome!",
      "prompt_id": "greeting",
      "status": "available",
      "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
    }
  • {
      "prompt": "Hello and welcome!",
      "prompt_id": "greeting",
      "status": "available",
      "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
    }

Delete a custom prompt

Beta

Deletes an existing custom prompt from a custom model. The service deletes the prompt with the specified ID. You must use credentials for the instance of the service that owns the custom model from which the prompt is to be deleted.

Caution: Deleting a custom prompt elicits a 400 response code from synthesis requests that attempt to use the prompt. Make sure that you do not attempt to use a deleted prompt in a production application. Custom prompts are supported only for use with US English custom models and voices.

See also: Deleting a custom prompt.

Deletes an existing custom prompt from a custom model. The service deletes the prompt with the specified ID. You must use credentials for the instance of the service that owns the custom model from which the prompt is to be deleted.

Caution: Deleting a custom prompt elicits a 400 response code from synthesis requests that attempt to use the prompt. Make sure that you do not attempt to use a deleted prompt in a production application. Custom prompts are supported only for use with US English custom models and voices.

See also: Deleting a custom prompt.

Deletes an existing custom prompt from a custom model. The service deletes the prompt with the specified ID. You must use credentials for the instance of the service that owns the custom model from which the prompt is to be deleted.

Caution: Deleting a custom prompt elicits a 400 response code from synthesis requests that attempt to use the prompt. Make sure that you do not attempt to use a deleted prompt in a production application. Custom prompts are supported only for use with US English custom models and voices.

See also: Deleting a custom prompt.

Deletes an existing custom prompt from a custom model. The service deletes the prompt with the specified ID. You must use credentials for the instance of the service that owns the custom model from which the prompt is to be deleted.

Caution: Deleting a custom prompt elicits a 400 response code from synthesis requests that attempt to use the prompt. Make sure that you do not attempt to use a deleted prompt in a production application. Custom prompts are supported only for use with US English custom models and voices.

See also: Deleting a custom prompt.

Deletes an existing custom prompt from a custom model. The service deletes the prompt with the specified ID. You must use credentials for the instance of the service that owns the custom model from which the prompt is to be deleted.

Caution: Deleting a custom prompt elicits a 400 response code from synthesis requests that attempt to use the prompt. Make sure that you do not attempt to use a deleted prompt in a production application. Custom prompts are supported only for use with US English custom models and voices.

See also: Deleting a custom prompt.

DELETE /v1/customizations/{customization_id}/prompts/{prompt_id}
DeleteCustomPrompt(string customizationId, string promptId)
ServiceCall<Void> deleteCustomPrompt(DeleteCustomPromptOptions deleteCustomPromptOptions)
deleteCustomPrompt(params)
delete_custom_prompt(
        self,
        customization_id: str,
        prompt_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the DeleteCustomPromptOptions.Builder to create a DeleteCustomPromptOptions object that contains the parameter values for the deleteCustomPrompt method.

Path Parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt that is to be deleted.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt that is to be deleted.

The deleteCustomPrompt options.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt that is to be deleted.

parameters

  • The customization ID (GUID) of the custom model. You must make the request with credentials for the instance of the service that owns the custom model.

  • The identifier (name) of the prompt that is to be deleted.

  • curl -X DELETE -u "apikey:{apikey}" "{url}/v1/customizations/{customization_id}/prompts/{prompt_id}"
  • curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/customizations/{customization_id}/prompts/{prompt_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteCustomPrompt(
        customizationId: "{customizationId}",
        promptId: "{promptId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteCustomPrompt(
        customizationId: "{customizationId}",
        promptId: "{promptId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteCustomPromptOptions deleteCustomPromptOptions =
      new DeleteCustomPromptOptions.Builder()
        .customizationId("{customizationId}")
        .promptId("{promptId}")
        .build();
    
    textToSpeech.deleteCustomPrompt(deleteCustomPromptOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteCustomPromptOptions deleteCustomPromptOptions =
      new DeleteCustomPromptOptions.Builder()
        .customizationId("{customizationId}")
        .promptId("{promptId}")
        .build();
    
    textToSpeech.deleteCustomPrompt(deleteCustomPromptOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteCustomPromptParams = {
      customizationId: '{customization_id}',
      promptId: '{prompt_id}',
    };
    
    textToSpeech.deleteCustomPrompt(deleteCustomPromptParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteCustomPromptParams = {
      customizationId: '{customization_id}',
      promptId: '{prompt_id}',
    };
    
    textToSpeech.deleteCustomPrompt(deleteCustomPromptParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_custom_prompt(
        '{customization_id}',
        '{prompt_id}'
    )
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_custom_prompt(
        '{customization_id}',
        '{prompt_id}'
    )

Response

Response type: object

Status Code

  • No Content. The prompt was deleted successfully.

  • Bad Request. The request failed. Possible failure causes include:

    • Invalid service credentials were passed with the request.
  • Unauthorized. The request failed. Possible failure causes include:

    • The specified customization_id is invalid for the requesting credentials.
    • The specified prompt_id is invalid for the requesting credentials.
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

List speaker models

Beta

Lists information about all speaker models that are defined for a service instance. The information includes the speaker ID and speaker name of each defined speaker. You must use credentials for the instance of a service to list its speakers. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing speaker models.

Lists information about all speaker models that are defined for a service instance. The information includes the speaker ID and speaker name of each defined speaker. You must use credentials for the instance of a service to list its speakers. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing speaker models.

Lists information about all speaker models that are defined for a service instance. The information includes the speaker ID and speaker name of each defined speaker. You must use credentials for the instance of a service to list its speakers. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing speaker models.

Lists information about all speaker models that are defined for a service instance. The information includes the speaker ID and speaker name of each defined speaker. You must use credentials for the instance of a service to list its speakers. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing speaker models.

Lists information about all speaker models that are defined for a service instance. The information includes the speaker ID and speaker name of each defined speaker. You must use credentials for the instance of a service to list its speakers. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing speaker models.

GET /v1/speakers
ListSpeakerModels()
ServiceCall<Speakers> listSpeakerModels()
listSpeakerModels(params)
list_speaker_models(
        self,
        **kwargs,
    ) -> DetailedResponse

Request

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/speakers"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/speakers"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListSpeakerModels();
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.ListSpeakerModels();
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    Speakers speakers = textToSpeech.listSpeakerModels().execute().getResult();
    System.out.println(speakers);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    Speakers speakers = textToSpeech.listSpeakerModels().execute().getResult();
    System.out.println(speakers);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.listSpeakerModels()
      .then(speakers => {
        console.log(JSON.stringify(speakers, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.listSpeakerModels()
      .then(speakers => {
        console.log(JSON.stringify(speakers, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    speakers = text_to_speech.list_speaker_models().get_result()
    print(json.dumps(speakers, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    speakers = text_to_speech.list_speaker_models().get_result()
    print(json.dumps(speakers, indent=2))

Response

Information about all speaker models for the service instance.

Information about all speaker models for the service instance.

Information about all speaker models for the service instance.

Information about all speaker models for the service instance.

Information about all speaker models for the service instance.

Status Code

  • OK. The request succeeded.

  • Bad Request. The request failed. Possible failure causes include:

    • Invalid service credentials were passed with the request.
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "speakers": [
        {
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833",
          "name": "speaker_one"
        },
        {
          "speaker_id": "323e4476-63de-9825-7cd7-8120e45f8331",
          "name": "speaker_two"
        }
      ]
    }
  • {
      "speakers": [
        {
          "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833",
          "name": "speaker_one"
        },
        {
          "speaker_id": "323e4476-63de-9825-7cd7-8120e45f8331",
          "name": "speaker_two"
        }
      ]
    }

Create a speaker model

Beta

Creates a new speaker model, which is an optional enrollment token for users who are to add prompts to custom models. A speaker model contains information about a user's voice. The service extracts this information from a WAV audio sample that you pass as the body of the request. Associating a speaker model with a prompt is optional, but the information that is extracted from the speaker model helps the service learn about the speaker's voice.

A speaker model can make an appreciable difference in the quality of prompts, especially short prompts with relatively little audio, that are associated with that speaker. A speaker model can help the service produce a prompt with more confidence; the lack of a speaker model can potentially compromise the quality of a prompt.

The gender of the speaker who creates a speaker model does not need to match the gender of a voice that is used with prompts that are associated with that speaker model. For example, a speaker model that is created by a male speaker can be associated with prompts that are spoken by female voices.

You create a speaker model for a given instance of the service. The new speaker model is owned by the service instance whose credentials are used to create it. That same speaker can then be used to create prompts for all custom models within that service instance. No language is associated with a speaker model, but each custom model has a single specified language. You can add prompts only to US English models.

You specify a name for the speaker when you create it. The name must be unique among all speaker names for the owning service instance. To re-create a speaker model for an existing speaker name, you must first delete the existing speaker model that has that name.

Speaker enrollment is a synchronous operation. Although it accepts more audio data than a prompt, the process of adding a speaker is very fast. The service simply extracts information about the speaker’s voice from the audio. Unlike prompts, speaker models neither need nor accept a transcription of the audio. When the call returns, the audio is fully processed and the speaker enrollment is complete.

The service returns a speaker ID with the request. A speaker ID is globally unique identifier (GUID) that you use to identify the speaker in subsequent requests to the service. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also:

Creates a new speaker model, which is an optional enrollment token for users who are to add prompts to custom models. A speaker model contains information about a user's voice. The service extracts this information from a WAV audio sample that you pass as the body of the request. Associating a speaker model with a prompt is optional, but the information that is extracted from the speaker model helps the service learn about the speaker's voice.

A speaker model can make an appreciable difference in the quality of prompts, especially short prompts with relatively little audio, that are associated with that speaker. A speaker model can help the service produce a prompt with more confidence; the lack of a speaker model can potentially compromise the quality of a prompt.

The gender of the speaker who creates a speaker model does not need to match the gender of a voice that is used with prompts that are associated with that speaker model. For example, a speaker model that is created by a male speaker can be associated with prompts that are spoken by female voices.

You create a speaker model for a given instance of the service. The new speaker model is owned by the service instance whose credentials are used to create it. That same speaker can then be used to create prompts for all custom models within that service instance. No language is associated with a speaker model, but each custom model has a single specified language. You can add prompts only to US English models.

You specify a name for the speaker when you create it. The name must be unique among all speaker names for the owning service instance. To re-create a speaker model for an existing speaker name, you must first delete the existing speaker model that has that name.

Speaker enrollment is a synchronous operation. Although it accepts more audio data than a prompt, the process of adding a speaker is very fast. The service simply extracts information about the speaker’s voice from the audio. Unlike prompts, speaker models neither need nor accept a transcription of the audio. When the call returns, the audio is fully processed and the speaker enrollment is complete.

The service returns a speaker ID with the request. A speaker ID is globally unique identifier (GUID) that you use to identify the speaker in subsequent requests to the service. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also:

Creates a new speaker model, which is an optional enrollment token for users who are to add prompts to custom models. A speaker model contains information about a user's voice. The service extracts this information from a WAV audio sample that you pass as the body of the request. Associating a speaker model with a prompt is optional, but the information that is extracted from the speaker model helps the service learn about the speaker's voice.

A speaker model can make an appreciable difference in the quality of prompts, especially short prompts with relatively little audio, that are associated with that speaker. A speaker model can help the service produce a prompt with more confidence; the lack of a speaker model can potentially compromise the quality of a prompt.

The gender of the speaker who creates a speaker model does not need to match the gender of a voice that is used with prompts that are associated with that speaker model. For example, a speaker model that is created by a male speaker can be associated with prompts that are spoken by female voices.

You create a speaker model for a given instance of the service. The new speaker model is owned by the service instance whose credentials are used to create it. That same speaker can then be used to create prompts for all custom models within that service instance. No language is associated with a speaker model, but each custom model has a single specified language. You can add prompts only to US English models.

You specify a name for the speaker when you create it. The name must be unique among all speaker names for the owning service instance. To re-create a speaker model for an existing speaker name, you must first delete the existing speaker model that has that name.

Speaker enrollment is a synchronous operation. Although it accepts more audio data than a prompt, the process of adding a speaker is very fast. The service simply extracts information about the speaker’s voice from the audio. Unlike prompts, speaker models neither need nor accept a transcription of the audio. When the call returns, the audio is fully processed and the speaker enrollment is complete.

The service returns a speaker ID with the request. A speaker ID is globally unique identifier (GUID) that you use to identify the speaker in subsequent requests to the service. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also:

Creates a new speaker model, which is an optional enrollment token for users who are to add prompts to custom models. A speaker model contains information about a user's voice. The service extracts this information from a WAV audio sample that you pass as the body of the request. Associating a speaker model with a prompt is optional, but the information that is extracted from the speaker model helps the service learn about the speaker's voice.

A speaker model can make an appreciable difference in the quality of prompts, especially short prompts with relatively little audio, that are associated with that speaker. A speaker model can help the service produce a prompt with more confidence; the lack of a speaker model can potentially compromise the quality of a prompt.

The gender of the speaker who creates a speaker model does not need to match the gender of a voice that is used with prompts that are associated with that speaker model. For example, a speaker model that is created by a male speaker can be associated with prompts that are spoken by female voices.

You create a speaker model for a given instance of the service. The new speaker model is owned by the service instance whose credentials are used to create it. That same speaker can then be used to create prompts for all custom models within that service instance. No language is associated with a speaker model, but each custom model has a single specified language. You can add prompts only to US English models.

You specify a name for the speaker when you create it. The name must be unique among all speaker names for the owning service instance. To re-create a speaker model for an existing speaker name, you must first delete the existing speaker model that has that name.

Speaker enrollment is a synchronous operation. Although it accepts more audio data than a prompt, the process of adding a speaker is very fast. The service simply extracts information about the speaker’s voice from the audio. Unlike prompts, speaker models neither need nor accept a transcription of the audio. When the call returns, the audio is fully processed and the speaker enrollment is complete.

The service returns a speaker ID with the request. A speaker ID is globally unique identifier (GUID) that you use to identify the speaker in subsequent requests to the service. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also:

Creates a new speaker model, which is an optional enrollment token for users who are to add prompts to custom models. A speaker model contains information about a user's voice. The service extracts this information from a WAV audio sample that you pass as the body of the request. Associating a speaker model with a prompt is optional, but the information that is extracted from the speaker model helps the service learn about the speaker's voice.

A speaker model can make an appreciable difference in the quality of prompts, especially short prompts with relatively little audio, that are associated with that speaker. A speaker model can help the service produce a prompt with more confidence; the lack of a speaker model can potentially compromise the quality of a prompt.

The gender of the speaker who creates a speaker model does not need to match the gender of a voice that is used with prompts that are associated with that speaker model. For example, a speaker model that is created by a male speaker can be associated with prompts that are spoken by female voices.

You create a speaker model for a given instance of the service. The new speaker model is owned by the service instance whose credentials are used to create it. That same speaker can then be used to create prompts for all custom models within that service instance. No language is associated with a speaker model, but each custom model has a single specified language. You can add prompts only to US English models.

You specify a name for the speaker when you create it. The name must be unique among all speaker names for the owning service instance. To re-create a speaker model for an existing speaker name, you must first delete the existing speaker model that has that name.

Speaker enrollment is a synchronous operation. Although it accepts more audio data than a prompt, the process of adding a speaker is very fast. The service simply extracts information about the speaker’s voice from the audio. Unlike prompts, speaker models neither need nor accept a transcription of the audio. When the call returns, the audio is fully processed and the speaker enrollment is complete.

The service returns a speaker ID with the request. A speaker ID is globally unique identifier (GUID) that you use to identify the speaker in subsequent requests to the service. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also:

POST /v1/speakers
CreateSpeakerModel(string speakerName, System.IO.MemoryStream audio)
ServiceCall<SpeakerModel> createSpeakerModel(CreateSpeakerModelOptions createSpeakerModelOptions)
createSpeakerModel(params)
create_speaker_model(
        self,
        speaker_name: str,
        audio: BinaryIO,
        **kwargs,
    ) -> DetailedResponse

Request

Use the CreateSpeakerModelOptions.Builder to create a CreateSpeakerModelOptions object that contains the parameter values for the createSpeakerModel method.

Custom Headers

  • The format (MIME type) of the audio, which must be audio/wav.

    Allowable values: [audio/wav]

Query Parameters

  • The name of the speaker that is to be added to the service instance.

    • Include a maximum of 49 characters in the name.
    • Include only alphanumeric characters and _ (underscores) in the name.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the name.
    • Do not use the name of an existing speaker that is already defined for the service instance.

An enrollment audio file that contains a sample of the speaker’s voice.

  • The enrollment audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. It transcodes all audio to 16 kHz before processing it.
  • The length of the enrollment audio is limited to 1 minute. Speaking one or two paragraphs of text that include five to ten sentences is recommended.

parameters

  • The name of the speaker that is to be added to the service instance.

    • Include a maximum of 49 characters in the name.
    • Include only alphanumeric characters and _ (underscores) in the name.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the name.
    • Do not use the name of an existing speaker that is already defined for the service instance.
  • An enrollment audio file that contains a sample of the speaker’s voice.

    • The enrollment audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. It transcodes all audio to 16 kHz before processing it.
    • The length of the enrollment audio is limited to 1 minute. Speaking one or two paragraphs of text that include five to ten sentences is recommended.

The createSpeakerModel options.

parameters

  • The name of the speaker that is to be added to the service instance.

    • Include a maximum of 49 characters in the name.
    • Include only alphanumeric characters and _ (underscores) in the name.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the name.
    • Do not use the name of an existing speaker that is already defined for the service instance.
  • An enrollment audio file that contains a sample of the speaker’s voice.

    • The enrollment audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. It transcodes all audio to 16 kHz before processing it.
    • The length of the enrollment audio is limited to 1 minute. Speaking one or two paragraphs of text that include five to ten sentences is recommended.

parameters

  • The name of the speaker that is to be added to the service instance.

    • Include a maximum of 49 characters in the name.
    • Include only alphanumeric characters and _ (underscores) in the name.
    • Do not include XML sensitive characters (double quotes, single quotes, ampersands, angle brackets, and slashes) in the name.
    • Do not use the name of an existing speaker that is already defined for the service instance.
  • An enrollment audio file that contains a sample of the speaker’s voice.

    • The enrollment audio must be in WAV format and must have a minimum sampling rate of 16 kHz. The service accepts audio with higher sampling rates. It transcodes all audio to 16 kHz before processing it.
    • The length of the enrollment audio is limited to 1 minute. Speaking one or two paragraphs of text that include five to ten sentences is recommended.
  • curl -X POST -u "apikey:{apikey}" --header "Content-Type: audio/wav" --data-binary "@audio-file.wav" "{url}/v1/speakers?speaker_name=speaker_one"
  • curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: audio/wav" --data-binary "@audio-file.wav" "{url}/v1/speakers?speaker_name=speaker_one"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.CreateSpeakerModel(
        speakerName: "speaker_one",
        audio: new MemoryStream(File.ReadAllBytes("audio-file.wav"))
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.CreateSpeakerModel(
        speakerName: "speaker_one",
        audio: new MemoryStream(File.ReadAllBytes("audio-file.wav"))
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    try {
      createSpeakerModelOptions createSpeakerModelOptions =
        new CreateSpeakerModelOptions.Builder()
          .speakerName("speaker_one")
          .audio(new File("audio-file.wav"))
          .build();
    
      SpeakerModel speakerModel =
        textToSpeech.createSpeakerModel(createSpeakerModelOptions).execute();
      System.out.println(speakerModel);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    try {
      createSpeakerModelOptions createSpeakerModelOptions =
        new CreateSpeakerModelOptions.Builder()
          .speakerName("speaker_one")
          .audio(new File("audio-file.wav"))
          .build();
    
      SpeakerModel speakerModel =
        textToSpeech.createSpeakerModel(createSpeakerModelOptions).execute();
      System.out.println(speakerModel);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    }
  • const fs = require('fs');
    const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const createSpeakerModelParams = {
      speakerName: 'speaker_one',
      audio: fs.createReadStream('./audio-file.wav'),
    };
    
    textToSpeech.createSpeakerModel(createSpeakerModelParams)
      .then(speakerModel => {
        console.log(JSON.stringify(speakerModel, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const fs = require('fs');
    const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const createSpeakerModelParams = {
      speakerName: 'speaker_one',
      audio: fs.createReadStream('./audio-file.wav'),
    };
    
    textToSpeech.createSpeakerModel(createSpeakerModelParams)
      .then(speakerModel => {
        console.log(JSON.stringify(speakerModel, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from os.path import join, dirname
    import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    with open(join(dirname(__file__), './.', 'audio-file.wav'),
                   'rb') as audio_file:
        speaker_model=text_to_speech.create_speaker_model(
            'speaker_one',
            audio_file
        ).get_result()
        print(json.dumps(speaker_model, indent=2))
  • from os.path import join, dirname
    import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    with open(join(dirname(__file__), './.', 'audio-file.wav'),
                   'rb') as audio_file:
        speaker_model=text_to_speech.create_speaker_model(
            'speaker_one',
            audio_file
        ).get_result()
        print(json.dumps(speaker_model, indent=2))

Response

The speaker ID of the speaker model.

The speaker ID of the speaker model.

The speaker ID of the speaker model.

The speaker ID of the speaker model.

The speaker ID of the speaker model.

Status Code

  • Created. The speaker model was created successfully.

  • Bad Request. The request failed. Possible failure causes include:

    • The audio has a media type other than audio/wav or a sampling rate of less than 16 kHz.
    • The audio is longer than 1 minute.
    • The speaker name exceeds the 49-character limit or includes characters that are not alphanumeric or underscores.
    • The speaker name is not unique within the service instance.
    • The service cannot process the audio for any reason (for example, the audio is corrupt).
    • Invalid service credentials were passed with the request.
  • Unsupported Media Type. The request passed an unacceptable media type for the enrollment audio with the Content-Type header. The header must pass a value of audio/wav.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
    }
  • {
      "speaker_id": "56367f89-546d-4b37-891e-4eb0c13cc833"
    }

Get a speaker model

Beta

Gets information about all prompts that are defined by a specified speaker for all custom models that are owned by a service instance. The information is grouped by the customization IDs of the custom models. For each custom model, the information lists information about each prompt that is defined for that custom model by the speaker. You must use credentials for the instance of the service that owns a speaker model to list its prompts. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing the custom prompts for a speaker model.

Gets information about all prompts that are defined by a specified speaker for all custom models that are owned by a service instance. The information is grouped by the customization IDs of the custom models. For each custom model, the information lists information about each prompt that is defined for that custom model by the speaker. You must use credentials for the instance of the service that owns a speaker model to list its prompts. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing the custom prompts for a speaker model.

Gets information about all prompts that are defined by a specified speaker for all custom models that are owned by a service instance. The information is grouped by the customization IDs of the custom models. For each custom model, the information lists information about each prompt that is defined for that custom model by the speaker. You must use credentials for the instance of the service that owns a speaker model to list its prompts. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing the custom prompts for a speaker model.

Gets information about all prompts that are defined by a specified speaker for all custom models that are owned by a service instance. The information is grouped by the customization IDs of the custom models. For each custom model, the information lists information about each prompt that is defined for that custom model by the speaker. You must use credentials for the instance of the service that owns a speaker model to list its prompts. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing the custom prompts for a speaker model.

Gets information about all prompts that are defined by a specified speaker for all custom models that are owned by a service instance. The information is grouped by the customization IDs of the custom models. For each custom model, the information lists information about each prompt that is defined for that custom model by the speaker. You must use credentials for the instance of the service that owns a speaker model to list its prompts. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Listing the custom prompts for a speaker model.

GET /v1/speakers/{speaker_id}
GetSpeakerModel(string speakerId)
ServiceCall<SpeakerCustomModels> getSpeakerModel(GetSpeakerModelOptions getSpeakerModelOptions)
getSpeakerModel(params)
get_speaker_model(
        self,
        speaker_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the GetSpeakerModelOptions.Builder to create a GetSpeakerModelOptions object that contains the parameter values for the getSpeakerModel method.

Path Parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

The getSpeakerModel options.

parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

  • curl -X GET -u "apikey:{apikey}" "{url}/v1/speakers/{speaker_id}"
  • curl -X GET --header "Authorization: Bearer {token}" "{url}/v1/speakers/{speaker_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetSpeakerModel(
        speakerId: "{speakerId}"
        );
    
    Console.WriteLine(result.Result);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.GetSpeakerModel(
        speakerId: "{speakerId}"
        );
    
    Console.WriteLine(result.Result);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetSpeakerModelOptions getSpeakerModelOptions =
      new GetSpeakerModelOptions.Builder()
        .speakerId("{speakerId}")
        .build();
    
    SpeakerCustomModels speakerCustomModels =
      textToSpeech.getSpeakerModel(getSpeakerModelOptions).execute().getResult();
    System.out.println(speakerCustomModels);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    GetSpeakerModelOptions getSpeakerModelOptions =
      new GetSpeakerModelOptions.Builder()
        .speakerId("{speakerId}")
        .build();
    
    SpeakerCustomModels speakerCustomModels =
      textToSpeech.getSpeakerModel(getSpeakerModelOptions).execute().getResult();
    System.out.println(speakerCustomModels);
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const getSpeakerModelParams = {
      speakerId: '{speaker_id}',
    };
    
    textToSpeech.getSpeakerModel(getSpeakerModelParams)
      .then(speakerCustomModels => {
        console.log(JSON.stringify(speakerCustomModels, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const getSpeakerModelParams = {
      speakerId: '{speaker_id}',
    };
    
    textToSpeech.getSpeakerModel(getSpeakerModelParams)
      .then(speakerCustomModels => {
        console.log(JSON.stringify(speakerCustomModels, null, 2));
      })
      .catch(err => {
        console.log('error:', err);
      });
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    speaker_custom_models = text_to_speech.get_speaker_model('{speaker_id'}).get_result()
    print(json.dumps(speaker_custom_models, indent=2))
  • import json
    from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    speaker_custom_models = text_to_speech.get_speaker_model('{speaker_id'}).get_result()
    print(json.dumps(speaker_custom_models, indent=2))

Response

Custom models for which the speaker has defined prompts.

Custom models for which the speaker has defined prompts.

Custom models for which the speaker has defined prompts.

Custom models for which the speaker has defined prompts.

Custom models for which the speaker has defined prompts.

Status Code

  • OK. The request succeeded.

  • Not Modified. The requested resource has not been modified since the time specified by the If-Modified-Since header, as documented in the HTTP specification.

  • Bad Request. The request failed. Possible failure causes include:

    • Invalid service credentials were passed with the request.
  • Unauthorized. The specified speaker_id is invalid for the requesting credentials.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

Example responses
  • {
      "customizations": [
        {
          "customization_id": "9937efc0-5341-b436-77e1-9923f6e693a1",
          "prompts": [
            {
              "prompt": "Hello and welcome!",
              "prompt_id": "greeting",
              "status": "available"
            },
            {
              "prompt": "How can I help you today?",
              "prompt_id": "help",
              "status": "processing"
            }
          ]
        },
        {
          "customization_id": "7ab01821-a312-7b55-8629-598a56b234f5",
          "prompts": [
            {
              "prompt": "Thank you and good-bye!",
              "prompt_id": "goodbye",
              "status": "available"
            },
            {
              "prompt": "I do not understand that response.",
              "prompt_id": "do_not_understand",
              "status": "available"
            }
          ]
        }
      ]
    }
  • {
      "customizations": [
        {
          "customization_id": "9937efc0-5341-b436-77e1-9923f6e693a1",
          "prompts": [
            {
              "prompt": "Hello and welcome!",
              "prompt_id": "greeting",
              "status": "available"
            },
            {
              "prompt": "How can I help you today?",
              "prompt_id": "help",
              "status": "processing"
            }
          ]
        },
        {
          "customization_id": "7ab01821-a312-7b55-8629-598a56b234f5",
          "prompts": [
            {
              "prompt": "Thank you and good-bye!",
              "prompt_id": "goodbye",
              "status": "available"
            },
            {
              "prompt": "I do not understand that response.",
              "prompt_id": "do_not_understand",
              "status": "available"
            }
          ]
        }
      ]
    }

Delete a speaker model

Beta

Deletes an existing speaker model from the service instance. The service deletes the enrolled speaker with the specified speaker ID. You must use credentials for the instance of the service that owns a speaker model to delete the speaker.

Any prompts that are associated with the deleted speaker are not affected by the speaker's deletion. The prosodic data that defines the quality of a prompt is established when the prompt is created. A prompt is static and remains unaffected by deletion of its associated speaker. However, the prompt cannot be resubmitted or updated with its original speaker once that speaker is deleted. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Deleting a speaker model.

Deletes an existing speaker model from the service instance. The service deletes the enrolled speaker with the specified speaker ID. You must use credentials for the instance of the service that owns a speaker model to delete the speaker.

Any prompts that are associated with the deleted speaker are not affected by the speaker's deletion. The prosodic data that defines the quality of a prompt is established when the prompt is created. A prompt is static and remains unaffected by deletion of its associated speaker. However, the prompt cannot be resubmitted or updated with its original speaker once that speaker is deleted. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Deleting a speaker model.

Deletes an existing speaker model from the service instance. The service deletes the enrolled speaker with the specified speaker ID. You must use credentials for the instance of the service that owns a speaker model to delete the speaker.

Any prompts that are associated with the deleted speaker are not affected by the speaker's deletion. The prosodic data that defines the quality of a prompt is established when the prompt is created. A prompt is static and remains unaffected by deletion of its associated speaker. However, the prompt cannot be resubmitted or updated with its original speaker once that speaker is deleted. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Deleting a speaker model.

Deletes an existing speaker model from the service instance. The service deletes the enrolled speaker with the specified speaker ID. You must use credentials for the instance of the service that owns a speaker model to delete the speaker.

Any prompts that are associated with the deleted speaker are not affected by the speaker's deletion. The prosodic data that defines the quality of a prompt is established when the prompt is created. A prompt is static and remains unaffected by deletion of its associated speaker. However, the prompt cannot be resubmitted or updated with its original speaker once that speaker is deleted. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Deleting a speaker model.

Deletes an existing speaker model from the service instance. The service deletes the enrolled speaker with the specified speaker ID. You must use credentials for the instance of the service that owns a speaker model to delete the speaker.

Any prompts that are associated with the deleted speaker are not affected by the speaker's deletion. The prosodic data that defines the quality of a prompt is established when the prompt is created. A prompt is static and remains unaffected by deletion of its associated speaker. However, the prompt cannot be resubmitted or updated with its original speaker once that speaker is deleted. Speaker models and the custom prompts with which they are used are supported only for use with US English custom models and voices.

See also: Deleting a speaker model.

DELETE /v1/speakers/{speaker_id}
DeleteSpeakerModel(string speakerId)
ServiceCall<Void> deleteSpeakerModel(DeleteSpeakerModelOptions deleteSpeakerModelOptions)
deleteSpeakerModel(params)
delete_speaker_model(
        self,
        speaker_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the DeleteSpeakerModelOptions.Builder to create a DeleteSpeakerModelOptions object that contains the parameter values for the deleteSpeakerModel method.

Path Parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

The deleteSpeakerModel options.

parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

parameters

  • The speaker ID (GUID) of the speaker model. You must make the request with service credentials for the instance of the service that owns the speaker model.

  • curl -X DELETE -u "apikey:{apikey}" "{url}/v1/speakers/{speaker_id}"
  • curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/speakers/{speaker_id}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteSpeakerModel(
        speakerId: "{speakerId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteSpeakerModel(
        speakerId: "{speakerId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteSpeakerModelOptions deleteSpeakerModelOptions =
      new DeleteSpeakerModelOptions.Builder()
        .speakerId("{speakerId}")
        .build();
    
    textToSpeech.deleteSpeakerModel(deleteSpeakerModelOptions).execute();
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteSpeakerModelOptions deleteSpeakerModelOptions =
      new DeleteSpeakerModelOptions.Builder()
        .speakerId("{speakerId}")
        .build();
    
    textToSpeech.deleteSpeakerModel(deleteSpeakerModelOptions).execute();
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteSpeakerModelParams = {
      speakerId: '{speaker_id}',
    };
    
    textToSpeech.deleteSpeakerModel(deleteSpeakerModelParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    textToSpeech.deleteSpeakerModel(deleteSpeakerModelParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_speaker_model('{speaker_id}')
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    import json
    
    text_to_speech.delete_speaker_model('{speaker_id}')

Response

Response type: object

Status Code

  • No Content. The speaker model was deleted successfully.

  • Bad Request. The request failed. Possible failure causes include:

    • Invalid service credentials were passed with the request.
  • Unauthorized. The specified speaker_id is invalid for the requesting credentials.

  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.

Delete labeled data

Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes the data.

Note: If you delete an instance of the service from the service console, all data associated with that service instance is automatically deleted. This includes all custom models and word/translation pairs, and all data related to speech synthesis requests.

See also: Information security.

Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes the data.

Note: If you delete an instance of the service from the service console, all data associated with that service instance is automatically deleted. This includes all custom models and word/translation pairs, and all data related to speech synthesis requests.

See also: Information security.

Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes the data.

Note: If you delete an instance of the service from the service console, all data associated with that service instance is automatically deleted. This includes all custom models and word/translation pairs, and all data related to speech synthesis requests.

See also: Information security.

Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes the data.

Note: If you delete an instance of the service from the service console, all data associated with that service instance is automatically deleted. This includes all custom models and word/translation pairs, and all data related to speech synthesis requests.

See also: Information security.

Deletes all data that is associated with a specified customer ID. The method deletes all data for the customer ID, regardless of the method by which the information was added. The method has no effect if no data is associated with the customer ID. You must issue the request with credentials for the same instance of the service that was used to associate the customer ID with the data. You associate a customer ID with data by passing the X-Watson-Metadata header with a request that passes the data.

Note: If you delete an instance of the service from the service console, all data associated with that service instance is automatically deleted. This includes all custom models and word/translation pairs, and all data related to speech synthesis requests.

See also: Information security.

DELETE /v1/user_data
DeleteUserData(string customerId)
ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOptions)
deleteUserData(params)
delete_user_data(
        self,
        customer_id: str,
        **kwargs,
    ) -> DetailedResponse

Request

Use the DeleteUserDataOptions.Builder to create a DeleteUserDataOptions object that contains the parameter values for the deleteUserData method.

Query Parameters

  • The customer ID for which all data is to be deleted.

parameters

  • The customer ID for which all data is to be deleted.

The deleteUserData options.

parameters

  • The customer ID for which all data is to be deleted.

parameters

  • The customer ID for which all data is to be deleted.

  • curl -X DELETE -u "apikey:{apikey}" "{url}/v1/user_data?customer_id={customer_id}"
  • curl -X DELETE --header "Authorization: Bearer {token}" "{url}/v1/user_data?customer_id={customer_ID}"
  • IamAuthenticator authenticator = new IamAuthenticator(
        apikey: "{apikey}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteUserData(
        customerId: "{customerId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator(
        url: "https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize",
        username: "{username}",
        password: "{password}"
        );
    
    TextToSpeechService textToSpeech = new TextToSpeechService(authenticator);
    textToSpeech.SetServiceUrl("{url}");
    
    var result = textToSpeech.DeleteUserData(
        customerId: "{customerId}"
        );
    
    Console.WriteLine(result.StatusCode);
  • IamAuthenticator authenticator = new IamAuthenticator("{apikey}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteUserDataOptions deleteUserDataOptions =
      new DeleteUserDataOptions.Builder()
        .customerId("{customerId}")
        .build();
    
    textToSpeech.deleteUserData(deleteUserDataOptions).execute();
    
  • CloudPakForDataAuthenticator authenticator = new CloudPakForDataAuthenticator("https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize", "{username}", "{password}");
    TextToSpeech textToSpeech = new TextToSpeech(authenticator);
    textToSpeech.setServiceUrl("{url}");
    
    DeleteUserDataOptions deleteUserDataOptions =
      new DeleteUserDataOptions.Builder()
        .customerId("{customerId}")
        .build();
    
    textToSpeech.deleteUserData(deleteUserDataOptions).execute();
    
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { IamAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new IamAuthenticator({
        apikey: '{apikey}',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteUserDataParams = {
      customerId: '{customer_id}',
    };
    
    textToSpeech.deleteUserData(deleteUserDataParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • const TextToSpeechV1 = require('ibm-watson/text-to-speech/v1');
    const { CloudPakForDataAuthenticator } = require('ibm-watson/auth');
    
    const textToSpeech = new TextToSpeechV1({
      authenticator: new CloudPakForDataAuthenticator({
        username: '{username}',
        password: '{password}',
        url: 'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize',
      }),
      serviceUrl: '{url}',
    });
    
    const deleteUserDataParams = {
      customerId: '{customer_id}',
    };
    
    textToSpeech.deleteUserData(deleteUserDataParams)
      .then(result => {
        // Response is empty.
      })
      .catch(err => {
        console.log('error:', err);
      });
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
    
    authenticator = IAMAuthenticator('{apikey}')
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_user_data('{customer_id}')
  • from ibm_watson import TextToSpeechV1
    from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
    
    authenticator = CloudPakForDataAuthenticator(
        '{username}',
        '{password}',
        'https://{cpd_cluster_host}{:port}/icp4d-api/v1/authorize'
    )
    
    text_to_speech = TextToSpeechV1(
        authenticator=authenticator
    )
    
    text_to_speech.set_service_url('{url}')
    
    text_to_speech.delete_user_data('{customer_id}')

Response

Response type: object

Status Code

  • OK. The deletion request was successfully submitted.

  • Bad Request. The request did not pass a customer ID:

    • No customer ID found in the request
  • Internal Server Error. The service experienced an internal error.

  • Service Unavailable. The service is currently unavailable.

No Sample Response

This method does not specify any sample responses.