Class: AWS.Polly

Inherits:
AWS.Service show all
Identifier:
polly
API Version:
2016-06-10
Defined in:
(unknown)

Overview

Constructs a service interface object. Each API operation is exposed as a function on service.

Service Description

Amazon Polly is a web service that makes it easy to synthesize speech from text.

The Amazon Polly service provides API operations for synthesizing high-quality speech from plain text and Speech Synthesis Markup Language (SSML), along with managing pronunciations lexicons that enable you to get the best results for your application domain.

Sending a Request Using Polly

var polly = new AWS.Polly();
polly.deleteLexicon(params, function (err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Locking the API Version

In order to ensure that the Polly object uses this specific API, you can construct the object by passing the apiVersion option to the constructor:

var polly = new AWS.Polly({apiVersion: '2016-06-10'});

You can also set the API version globally in AWS.config.apiVersions using the polly service identifier:

AWS.config.apiVersions = {
  polly: '2016-06-10',
  // other service API versions
};

var polly = new AWS.Polly();

Version:

  • 2016-06-10

Defined Under Namespace

Classes: Presigner

Constructor Summary

Property Summary

Properties inherited from AWS.Service

apiVersions

Method Summary

Methods inherited from AWS.Service

makeRequest, makeUnauthenticatedRequest, waitFor, setupRequestListeners, defineService

Constructor Details

new AWS.Polly(options = {}) ⇒ Object

Constructs a service object. This object has one method for each API operation.

Examples:

Constructing a Polly object

var polly = new AWS.Polly({apiVersion: '2016-06-10'});

Options Hash (options):

  • params (map)

    An optional map of parameters to bind to every request sent by this service object. For more information on bound parameters, see "Working with Services" in the Getting Started Guide.

  • endpoint (String)

    The endpoint URI to send requests to. The default endpoint is built from the configured region. The endpoint should be a string like 'https://{service}.{region}.amazonaws.com'.

  • accessKeyId (String)

    your AWS access key ID.

  • secretAccessKey (String)

    your AWS secret access key.

  • sessionToken (AWS.Credentials)

    the optional AWS session token to sign requests with.

  • credentials (AWS.Credentials)

    the AWS credentials to sign requests with. You can either specify this object, or specify the accessKeyId and secretAccessKey options directly.

  • credentialProvider (AWS.CredentialProviderChain)

    the provider chain used to resolve credentials if no static credentials property is set.

  • region (String)

    the region to send service requests to. See AWS.Polly.region for more information.

  • maxRetries (Integer)

    the maximum amount of retries to attempt with a request. See AWS.Polly.maxRetries for more information.

  • maxRedirects (Integer)

    the maximum amount of redirects to follow with a request. See AWS.Polly.maxRedirects for more information.

  • sslEnabled (Boolean)

    whether to enable SSL for requests.

  • paramValidation (Boolean|map)

    whether input parameters should be validated against the operation description before sending the request. Defaults to true. Pass a map to enable any of the following specific validation features:

    • min [Boolean] — Validates that a value meets the min constraint. This is enabled by default when paramValidation is set to true.
    • max [Boolean] — Validates that a value meets the max constraint.
    • pattern [Boolean] — Validates that a string value matches a regular expression.
    • enum [Boolean] — Validates that a string value matches one of the allowable enum values.
  • computeChecksums (Boolean)

    whether to compute checksums for payload bodies when the service accepts it (currently supported in S3 only)

  • convertResponseTypes (Boolean)

    whether types are converted when parsing response data. Currently only supported for JSON based services. Turning this off may improve performance on large response payloads. Defaults to true.

  • correctClockSkew (Boolean)

    whether to apply a clock skew correction and retry requests that fail because of an skewed client clock. Defaults to false.

  • s3ForcePathStyle (Boolean)

    whether to force path style URLs for S3 objects.

  • s3BucketEndpoint (Boolean)

    whether the provided endpoint addresses an individual bucket (false if it addresses the root API endpoint). Note that setting this configuration option requires an endpoint to be provided explicitly to the service constructor.

  • s3DisableBodySigning (Boolean)

    whether S3 body signing should be disabled when using signature version v4. Body signing can only be disabled when using https. Defaults to true.

  • retryDelayOptions (map)

    A set of options to configure the retry delay on retryable errors. Currently supported options are:

    • base [Integer] — The base number of milliseconds to use in the exponential backoff for operation retries. Defaults to 100 ms for all services except DynamoDB, where it defaults to 50ms.
    • customBackoff [function] — A custom function that accepts a retry count and returns the amount of time to delay in milliseconds. The base option will be ignored if this option is supplied.
  • httpOptions (map)

    A set of options to pass to the low-level HTTP request. Currently supported options are:

    • proxy [String] — the URL to proxy requests through
    • agent [http.Agent, https.Agent] — the Agent object to perform HTTP requests with. Used for connection pooling. Defaults to the global agent (http.globalAgent) for non-SSL connections. Note that for SSL connections, a special Agent object is used in order to enable peer certificate verification. This feature is only available in the Node.js environment.
    • connectTimeout [Integer] — Sets the socket to timeout after failing to establish a connection with the server after connectTimeout milliseconds. This timeout has no effect once a socket connection has been established.
    • timeout [Integer] — Sets the socket to timeout after timeout milliseconds of inactivity on the socket. Defaults to two minutes (120000).
    • xhrAsync [Boolean] — Whether the SDK will send asynchronous HTTP requests. Used in the browser environment only. Set to false to send requests synchronously. Defaults to true (async on).
    • xhrWithCredentials [Boolean] — Sets the "withCredentials" property of an XMLHttpRequest object. Used in the browser environment only. Defaults to false.
  • apiVersion (String, Date)

    a String in YYYY-MM-DD format (or a date) that represents the latest possible API version that can be used in all services (unless overridden by apiVersions). Specify 'latest' to use the latest possible version.

  • apiVersions (map<String, String|Date>)

    a map of service identifiers (the lowercase service class name) with the API version to use when instantiating a service. Specify 'latest' for each individual that can use the latest available version.

  • logger (#write, #log)

    an object that responds to .write() (like a stream) or .log() (like the console object) in order to log information about requests

  • systemClockOffset (Number)

    an offset value in milliseconds to apply to all signing times. Use this to compensate for clock skew when your system may be out of sync with the service time. Note that this configuration option can only be applied to the global AWS.config object and cannot be overridden in service-specific configuration. Defaults to 0 milliseconds.

  • signatureVersion (String)

    the signature version to sign requests with (overriding the API configuration). Possible values are: 'v2', 'v3', 'v4'.

  • signatureCache (Boolean)

    whether the signature to sign requests with (overriding the API configuration) is cached. Only applies to the signature version 'v4'. Defaults to true.

  • dynamoDbCrc32 (Boolean)

    whether to validate the CRC32 checksum of HTTP response bodies returned by DynamoDB. Default: true.

  • useAccelerateEndpoint (Boolean)

    Whether to use the S3 Transfer Acceleration endpoint with the S3 service. Default: false.

  • clientSideMonitoring (Boolean)

    whether to collect and publish this client's performance metrics of all its API requests.

  • endpointDiscoveryEnabled (Boolean)

    whether to enable endpoint discovery for operations that allow optionally using an endpoint returned by the service. Defaults to 'false'

  • endpointCacheSize (Number)

    the size of the global cache storing endpoints from endpoint discovery operations. Once endpoint cache is created, updating this setting cannot change existing cache size. Defaults to 1000

  • hostPrefixEnabled (Boolean)

    whether to marshal request parameters to the prefix of hostname. Defaults to true.

Property Details

endpointAWS.Endpoint (readwrite)

Returns an Endpoint object representing the endpoint URL for service requests.

Returns:

  • (AWS.Endpoint)

    an Endpoint object representing the endpoint URL for service requests.

Method Details

deleteLexicon(params = {}, callback) ⇒ AWS.Request

Deletes the specified pronunciation lexicon stored in an AWS Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the GetLexicon or ListLexicon APIs.

For more information, see Managing Lexicons.

Service Reference:

Examples:

To delete a lexicon


/* Deletes a specified pronunciation lexicon stored in an AWS Region. */

 var params = {
  Name: "example"
 };
 polly.deleteLexicon(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the deleteLexicon operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
polly.deleteLexicon(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      The name of the lexicon to delete. Must be an existing lexicon in the region.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

describeVoices(params = {}, callback) ⇒ AWS.Request

Returns the list of voices that are available for use when requesting speech synthesis. Each voice speaks a specified language, is either male or female, and is identified by an ID, which is the ASCII version of the voice name.

When synthesizing speech ( SynthesizeSpeech ), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices.

For example, you want your news reader application to read news in a specific language, but giving a user the option to choose the voice. Using the DescribeVoices operation you can provide the user with a list of available voices to select from.

You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.

This operation requires permissions to perform the polly:DescribeVoices action.

Service Reference:

Examples:

To describe available voices


/* Returns the list of voices that are available for use when requesting speech synthesis. Displayed languages are those within the specified language code. If no language code is specified, voices for all available languages are displayed. */

 var params = {
  LanguageCode: "en-GB"
 };
 polly.describeVoices(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Voices: [
       {
      Gender: "Female", 
      Id: "Emma", 
      LanguageCode: "en-GB", 
      LanguageName: "British English", 
      Name: "Emma"
     }, 
       {
      Gender: "Male", 
      Id: "Brian", 
      LanguageCode: "en-GB", 
      LanguageName: "British English", 
      Name: "Brian"
     }, 
       {
      Gender: "Female", 
      Id: "Amy", 
      LanguageCode: "en-GB", 
      LanguageName: "British English", 
      Name: "Amy"
     }
    ]
   }
   */
 });

Calling the describeVoices operation

var params = {
  IncludeAdditionalLanguageCodes: true || false,
  LanguageCode: arb | cmn-CN | cy-GB | da-DK | de-DE | en-AU | en-GB | en-GB-WLS | en-IN | en-US | es-ES | es-MX | es-US | fr-CA | fr-FR | is-IS | it-IT | ja-JP | hi-IN | ko-KR | nb-NO | nl-NL | pl-PL | pt-BR | pt-PT | ro-RO | ru-RU | sv-SE | tr-TR,
  NextToken: 'STRING_VALUE'
};
polly.describeVoices(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LanguageCode — (String)

      The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned.

      Possible values include:
      • "arb"
      • "cmn-CN"
      • "cy-GB"
      • "da-DK"
      • "de-DE"
      • "en-AU"
      • "en-GB"
      • "en-GB-WLS"
      • "en-IN"
      • "en-US"
      • "es-ES"
      • "es-MX"
      • "es-US"
      • "fr-CA"
      • "fr-FR"
      • "is-IS"
      • "it-IT"
      • "ja-JP"
      • "hi-IN"
      • "ko-KR"
      • "nb-NO"
      • "nl-NL"
      • "pl-PL"
      • "pt-BR"
      • "pt-PT"
      • "ro-RO"
      • "ru-RU"
      • "sv-SE"
      • "tr-TR"
    • IncludeAdditionalLanguageCodes — (Boolean)

      Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify yes but not if you specify no.

    • NextToken — (String)

      An opaque pagination token returned from the previous DescribeVoices operation. If present, this indicates where to continue the listing.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Voices — (Array<map>)

        A list of voices with their properties.

        • Gender — (String)

          Gender of the voice.

          Possible values include:
          • "Female"
          • "Male"
        • Id — (String)

          Amazon Polly assigned voice ID. This is the ID that you specify when calling the SynthesizeSpeech operation.

          Possible values include:
          • "Aditi"
          • "Amy"
          • "Astrid"
          • "Bianca"
          • "Brian"
          • "Carla"
          • "Carmen"
          • "Celine"
          • "Chantal"
          • "Conchita"
          • "Cristiano"
          • "Dora"
          • "Emma"
          • "Enrique"
          • "Ewa"
          • "Filiz"
          • "Geraint"
          • "Giorgio"
          • "Gwyneth"
          • "Hans"
          • "Ines"
          • "Ivy"
          • "Jacek"
          • "Jan"
          • "Joanna"
          • "Joey"
          • "Justin"
          • "Karl"
          • "Kendra"
          • "Kimberly"
          • "Lea"
          • "Liv"
          • "Lotte"
          • "Lucia"
          • "Mads"
          • "Maja"
          • "Marlene"
          • "Mathieu"
          • "Matthew"
          • "Maxim"
          • "Mia"
          • "Miguel"
          • "Mizuki"
          • "Naja"
          • "Nicole"
          • "Penelope"
          • "Raveena"
          • "Ricardo"
          • "Ruben"
          • "Russell"
          • "Salli"
          • "Seoyeon"
          • "Takumi"
          • "Tatyana"
          • "Vicki"
          • "Vitoria"
          • "Zeina"
          • "Zhiyu"
        • LanguageCode — (String)

          Language code of the voice.

          Possible values include:
          • "arb"
          • "cmn-CN"
          • "cy-GB"
          • "da-DK"
          • "de-DE"
          • "en-AU"
          • "en-GB"
          • "en-GB-WLS"
          • "en-IN"
          • "en-US"
          • "es-ES"
          • "es-MX"
          • "es-US"
          • "fr-CA"
          • "fr-FR"
          • "is-IS"
          • "it-IT"
          • "ja-JP"
          • "hi-IN"
          • "ko-KR"
          • "nb-NO"
          • "nl-NL"
          • "pl-PL"
          • "pt-BR"
          • "pt-PT"
          • "ro-RO"
          • "ru-RU"
          • "sv-SE"
          • "tr-TR"
        • LanguageName — (String)

          Human readable name of the language in English.

        • Name — (String)

          Name of the voice (for example, Salli, Kendra, etc.). This provides a human readable voice name that you might display in your application.

        • AdditionalLanguageCodes — (Array<String>)

          Additional codes for languages available for the specified voice in addition to its default language.

          For example, the default language for Aditi is Indian English (en-IN) because it was first used for that language. Since Aditi is bilingual and fluent in both Indian English and Hindi, this parameter would show the code hi-IN.

      • NextToken — (String)

        The pagination token to use in the next request to continue the listing of voices. NextToken is returned only if the response is truncated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getLexicon(params = {}, callback) ⇒ AWS.Request

Returns the content of the specified pronunciation lexicon stored in an AWS Region. For more information, see Managing Lexicons.

Service Reference:

Examples:

To retrieve a lexicon


/* Returns the content of the specified pronunciation lexicon stored in an AWS Region. */

 var params = {
  Name: ""
 };
 polly.getLexicon(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Lexicon: {
     Content: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<lexicon version=\"1.0\" \r\n      xmlns=\"http://www.w3.org/2005/01/pronunciation-lexicon\"\r\n      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \r\n      xsi:schemaLocation=\"http://www.w3.org/2005/01/pronunciation-lexicon \r\n        http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd\"\r\n      alphabet=\"ipa\" \r\n      xml:lang=\"en-US\">\r\n  <lexeme>\r\n    <grapheme>W3C</grapheme>\r\n    <alias>World Wide Web Consortium</alias>\r\n  </lexeme>\r\n</lexicon>", 
     Name: "example"
    }, 
    LexiconAttributes: {
     Alphabet: "ipa", 
     LanguageCode: "en-US", 
     LastModified: <Date Representation>, 
     LexemesCount: 1, 
     LexiconArn: "arn:aws:polly:us-east-1:123456789012:lexicon/example", 
     Size: 503
    }
   }
   */
 });

Calling the getLexicon operation

var params = {
  Name: 'STRING_VALUE' /* required */
};
polly.getLexicon(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      Name of the lexicon.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Lexicon — (map)

        Lexicon object that provides name and the string content of the lexicon.

        • Content — (String)

          Lexicon content in string format. The content of a lexicon must be in PLS format.

        • Name — (String)

          Name of the lexicon.

      • LexiconAttributes — (map)

        Metadata of the lexicon, including phonetic alphabetic used, language code, lexicon ARN, number of lexemes defined in the lexicon, and size of lexicon in bytes.

        • Alphabet — (String)

          Phonetic alphabet used in the lexicon. Valid values are ipa and x-sampa.

        • LanguageCode — (String)

          Language code that the lexicon applies to. A lexicon with a language code such as "en" would be applied to all English languages (en-GB, en-US, en-AUS, en-WLS, and so on.

          Possible values include:
          • "arb"
          • "cmn-CN"
          • "cy-GB"
          • "da-DK"
          • "de-DE"
          • "en-AU"
          • "en-GB"
          • "en-GB-WLS"
          • "en-IN"
          • "en-US"
          • "es-ES"
          • "es-MX"
          • "es-US"
          • "fr-CA"
          • "fr-FR"
          • "is-IS"
          • "it-IT"
          • "ja-JP"
          • "hi-IN"
          • "ko-KR"
          • "nb-NO"
          • "nl-NL"
          • "pl-PL"
          • "pt-BR"
          • "pt-PT"
          • "ro-RO"
          • "ru-RU"
          • "sv-SE"
          • "tr-TR"
        • LastModified — (Date)

          Date lexicon was last modified (a timestamp value).

        • LexiconArn — (String)

          Amazon Resource Name (ARN) of the lexicon.

        • LexemesCount — (Integer)

          Number of lexemes in the lexicon.

        • Size — (Integer)

          Total size of the lexicon, in characters.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

getSpeechSynthesisTask(params = {}, callback) ⇒ AWS.Request

Retrieves a specific SpeechSynthesisTask object based on its TaskID. This object contains information about the given speech synthesis task, including the status of the task, and a link to the S3 bucket containing the output of the task.

Service Reference:

Examples:

Calling the getSpeechSynthesisTask operation

var params = {
  TaskId: 'STRING_VALUE' /* required */
};
polly.getSpeechSynthesisTask(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • TaskId — (String)

      The Amazon Polly generated identifier for a speech synthesis task.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SynthesisTask — (map)

        SynthesisTask object that provides information from the requested task, including output format, creation time, task status, and so on.

        • TaskId — (String)

          The Amazon Polly generated identifier for a speech synthesis task.

        • TaskStatus — (String)

          Current status of the individual speech synthesis task.

          Possible values include:
          • "scheduled"
          • "inProgress"
          • "completed"
          • "failed"
        • TaskStatusReason — (String)

          Reason for the current status of a specific speech synthesis task, including errors if the task has failed.

        • OutputUri — (String)

          Pathway for the output speech file.

        • CreationTime — (Date)

          Timestamp for the time the synthesis task was started.

        • RequestCharacters — (Integer)

          Number of billable characters synthesized.

        • SnsTopicArn — (String)

          ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.

        • LexiconNames — (Array<String>)

          List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice.

        • OutputFormat — (String)

          The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

          Possible values include:
          • "json"
          • "mp3"
          • "ogg_vorbis"
          • "pcm"
        • SampleRate — (String)

          The audio frequency specified in Hz.

          The valid values for mp3 and ogg_vorbis are "8000", "16000", and "22050". The default value is "22050".

          Valid values for pcm are "8000" and "16000" The default value is "16000".

        • SpeechMarkTypes — (Array<String>)

          The type of speech marks returned for the input text.

        • TextType — (String)

          Specifies whether the input text is plain text or SSML. The default value is plain text.

          Possible values include:
          • "ssml"
          • "text"
        • VoiceId — (String)

          Voice ID to use for the synthesis.

          Possible values include:
          • "Aditi"
          • "Amy"
          • "Astrid"
          • "Bianca"
          • "Brian"
          • "Carla"
          • "Carmen"
          • "Celine"
          • "Chantal"
          • "Conchita"
          • "Cristiano"
          • "Dora"
          • "Emma"
          • "Enrique"
          • "Ewa"
          • "Filiz"
          • "Geraint"
          • "Giorgio"
          • "Gwyneth"
          • "Hans"
          • "Ines"
          • "Ivy"
          • "Jacek"
          • "Jan"
          • "Joanna"
          • "Joey"
          • "Justin"
          • "Karl"
          • "Kendra"
          • "Kimberly"
          • "Lea"
          • "Liv"
          • "Lotte"
          • "Lucia"
          • "Mads"
          • "Maja"
          • "Marlene"
          • "Mathieu"
          • "Matthew"
          • "Maxim"
          • "Mia"
          • "Miguel"
          • "Mizuki"
          • "Naja"
          • "Nicole"
          • "Penelope"
          • "Raveena"
          • "Ricardo"
          • "Ruben"
          • "Russell"
          • "Salli"
          • "Seoyeon"
          • "Takumi"
          • "Tatyana"
          • "Vicki"
          • "Vitoria"
          • "Zeina"
          • "Zhiyu"
        • LanguageCode — (String)

          Optional language code for a synthesis task. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).

          If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.

          Possible values include:
          • "arb"
          • "cmn-CN"
          • "cy-GB"
          • "da-DK"
          • "de-DE"
          • "en-AU"
          • "en-GB"
          • "en-GB-WLS"
          • "en-IN"
          • "en-US"
          • "es-ES"
          • "es-MX"
          • "es-US"
          • "fr-CA"
          • "fr-FR"
          • "is-IS"
          • "it-IT"
          • "ja-JP"
          • "hi-IN"
          • "ko-KR"
          • "nb-NO"
          • "nl-NL"
          • "pl-PL"
          • "pt-BR"
          • "pt-PT"
          • "ro-RO"
          • "ru-RU"
          • "sv-SE"
          • "tr-TR"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listLexicons(params = {}, callback) ⇒ AWS.Request

Returns a list of pronunciation lexicons stored in an AWS Region. For more information, see Managing Lexicons.

Service Reference:

Examples:

To list all lexicons in a region


/* Returns a list of pronunciation lexicons stored in an AWS Region. */

 var params = {
 };
 polly.listLexicons(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    Lexicons: [
       {
      Attributes: {
       Alphabet: "ipa", 
       LanguageCode: "en-US", 
       LastModified: <Date Representation>, 
       LexemesCount: 1, 
       LexiconArn: "arn:aws:polly:us-east-1:123456789012:lexicon/example", 
       Size: 503
      }, 
      Name: "example"
     }
    ]
   }
   */
 });

Calling the listLexicons operation

var params = {
  NextToken: 'STRING_VALUE'
};
polly.listLexicons(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • NextToken — (String)

      An opaque pagination token returned from previous ListLexicons operation. If present, indicates where to continue the list of lexicons.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • Lexicons — (Array<map>)

        A list of lexicon names and attributes.

        • Name — (String)

          Name of the lexicon.

        • Attributes — (map)

          Provides lexicon metadata.

          • Alphabet — (String)

            Phonetic alphabet used in the lexicon. Valid values are ipa and x-sampa.

          • LanguageCode — (String)

            Language code that the lexicon applies to. A lexicon with a language code such as "en" would be applied to all English languages (en-GB, en-US, en-AUS, en-WLS, and so on.

            Possible values include:
            • "arb"
            • "cmn-CN"
            • "cy-GB"
            • "da-DK"
            • "de-DE"
            • "en-AU"
            • "en-GB"
            • "en-GB-WLS"
            • "en-IN"
            • "en-US"
            • "es-ES"
            • "es-MX"
            • "es-US"
            • "fr-CA"
            • "fr-FR"
            • "is-IS"
            • "it-IT"
            • "ja-JP"
            • "hi-IN"
            • "ko-KR"
            • "nb-NO"
            • "nl-NL"
            • "pl-PL"
            • "pt-BR"
            • "pt-PT"
            • "ro-RO"
            • "ru-RU"
            • "sv-SE"
            • "tr-TR"
          • LastModified — (Date)

            Date lexicon was last modified (a timestamp value).

          • LexiconArn — (String)

            Amazon Resource Name (ARN) of the lexicon.

          • LexemesCount — (Integer)

            Number of lexemes in the lexicon.

          • Size — (Integer)

            Total size of the lexicon, in characters.

      • NextToken — (String)

        The pagination token to use in the next request to continue the listing of lexicons. NextToken is returned only if the response is truncated.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

listSpeechSynthesisTasks(params = {}, callback) ⇒ AWS.Request

Returns a list of SpeechSynthesisTask objects ordered by their creation date. This operation can filter the tasks by their status, for example, allowing users to list only tasks that are completed.

Service Reference:

Examples:

Calling the listSpeechSynthesisTasks operation

var params = {
  MaxResults: 'NUMBER_VALUE',
  NextToken: 'STRING_VALUE',
  Status: scheduled | inProgress | completed | failed
};
polly.listSpeechSynthesisTasks(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • MaxResults — (Integer)

      Maximum number of speech synthesis tasks returned in a List operation.

    • NextToken — (String)

      The pagination token to use in the next request to continue the listing of speech synthesis tasks.

    • Status — (String)

      Status of the speech synthesis tasks returned in a List operation

      Possible values include:
      • "scheduled"
      • "inProgress"
      • "completed"
      • "failed"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • NextToken — (String)

        An opaque pagination token returned from the previous List operation in this request. If present, this indicates where to continue the listing.

      • SynthesisTasks — (Array<map>)

        List of SynthesisTask objects that provides information from the specified task in the list request, including output format, creation time, task status, and so on.

        • TaskId — (String)

          The Amazon Polly generated identifier for a speech synthesis task.

        • TaskStatus — (String)

          Current status of the individual speech synthesis task.

          Possible values include:
          • "scheduled"
          • "inProgress"
          • "completed"
          • "failed"
        • TaskStatusReason — (String)

          Reason for the current status of a specific speech synthesis task, including errors if the task has failed.

        • OutputUri — (String)

          Pathway for the output speech file.

        • CreationTime — (Date)

          Timestamp for the time the synthesis task was started.

        • RequestCharacters — (Integer)

          Number of billable characters synthesized.

        • SnsTopicArn — (String)

          ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.

        • LexiconNames — (Array<String>)

          List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice.

        • OutputFormat — (String)

          The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

          Possible values include:
          • "json"
          • "mp3"
          • "ogg_vorbis"
          • "pcm"
        • SampleRate — (String)

          The audio frequency specified in Hz.

          The valid values for mp3 and ogg_vorbis are "8000", "16000", and "22050". The default value is "22050".

          Valid values for pcm are "8000" and "16000" The default value is "16000".

        • SpeechMarkTypes — (Array<String>)

          The type of speech marks returned for the input text.

        • TextType — (String)

          Specifies whether the input text is plain text or SSML. The default value is plain text.

          Possible values include:
          • "ssml"
          • "text"
        • VoiceId — (String)

          Voice ID to use for the synthesis.

          Possible values include:
          • "Aditi"
          • "Amy"
          • "Astrid"
          • "Bianca"
          • "Brian"
          • "Carla"
          • "Carmen"
          • "Celine"
          • "Chantal"
          • "Conchita"
          • "Cristiano"
          • "Dora"
          • "Emma"
          • "Enrique"
          • "Ewa"
          • "Filiz"
          • "Geraint"
          • "Giorgio"
          • "Gwyneth"
          • "Hans"
          • "Ines"
          • "Ivy"
          • "Jacek"
          • "Jan"
          • "Joanna"
          • "Joey"
          • "Justin"
          • "Karl"
          • "Kendra"
          • "Kimberly"
          • "Lea"
          • "Liv"
          • "Lotte"
          • "Lucia"
          • "Mads"
          • "Maja"
          • "Marlene"
          • "Mathieu"
          • "Matthew"
          • "Maxim"
          • "Mia"
          • "Miguel"
          • "Mizuki"
          • "Naja"
          • "Nicole"
          • "Penelope"
          • "Raveena"
          • "Ricardo"
          • "Ruben"
          • "Russell"
          • "Salli"
          • "Seoyeon"
          • "Takumi"
          • "Tatyana"
          • "Vicki"
          • "Vitoria"
          • "Zeina"
          • "Zhiyu"
        • LanguageCode — (String)

          Optional language code for a synthesis task. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).

          If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.

          Possible values include:
          • "arb"
          • "cmn-CN"
          • "cy-GB"
          • "da-DK"
          • "de-DE"
          • "en-AU"
          • "en-GB"
          • "en-GB-WLS"
          • "en-IN"
          • "en-US"
          • "es-ES"
          • "es-MX"
          • "es-US"
          • "fr-CA"
          • "fr-FR"
          • "is-IS"
          • "it-IT"
          • "ja-JP"
          • "hi-IN"
          • "ko-KR"
          • "nb-NO"
          • "nl-NL"
          • "pl-PL"
          • "pt-BR"
          • "pt-PT"
          • "ro-RO"
          • "ru-RU"
          • "sv-SE"
          • "tr-TR"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

putLexicon(params = {}, callback) ⇒ AWS.Request

Stores a pronunciation lexicon in an AWS Region. If a lexicon with the same name already exists in the region, it is overwritten by the new lexicon. Lexicon operations have eventual consistency, therefore, it might take some time before the lexicon is available to the SynthesizeSpeech operation.

For more information, see Managing Lexicons.

Service Reference:

Examples:

To save a lexicon


/* Stores a pronunciation lexicon in an AWS Region. */

 var params = {
  Content: "file://example.pls", 
  Name: "W3C"
 };
 polly.putLexicon(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
   }
   */
 });

Calling the putLexicon operation

var params = {
  Content: 'STRING_VALUE', /* required */
  Name: 'STRING_VALUE' /* required */
};
polly.putLexicon(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • Name — (String)

      Name of the lexicon. The name must follow the regular express format [0-9A-Za-z]{1,20}. That is, the name is a case-sensitive alphanumeric string up to 20 characters long.

    • Content — (String)

      Content of the PLS lexicon as string data.

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

startSpeechSynthesisTask(params = {}, callback) ⇒ AWS.Request

Allows the creation of an asynchronous synthesis task, by starting a new SpeechSynthesisTask. This operation requires all the standard information needed for speech synthesis, plus the name of an Amazon S3 bucket for the service to store the output of the synthesis task and two optional parameters (OutputS3KeyPrefix and SnsTopicArn). Once the synthesis task is created, this operation will return a SpeechSynthesisTask object, which will include an identifier of this task as well as the current status.

Service Reference:

Examples:

Calling the startSpeechSynthesisTask operation

var params = {
  OutputFormat: json | mp3 | ogg_vorbis | pcm, /* required */
  OutputS3BucketName: 'STRING_VALUE', /* required */
  Text: 'STRING_VALUE', /* required */
  VoiceId: Aditi | Amy | Astrid | Bianca | Brian | Carla | Carmen | Celine | Chantal | Conchita | Cristiano | Dora | Emma | Enrique | Ewa | Filiz | Geraint | Giorgio | Gwyneth | Hans | Ines | Ivy | Jacek | Jan | Joanna | Joey | Justin | Karl | Kendra | Kimberly | Lea | Liv | Lotte | Lucia | Mads | Maja | Marlene | Mathieu | Matthew | Maxim | Mia | Miguel | Mizuki | Naja | Nicole | Penelope | Raveena | Ricardo | Ruben | Russell | Salli | Seoyeon | Takumi | Tatyana | Vicki | Vitoria | Zeina | Zhiyu, /* required */
  LanguageCode: arb | cmn-CN | cy-GB | da-DK | de-DE | en-AU | en-GB | en-GB-WLS | en-IN | en-US | es-ES | es-MX | es-US | fr-CA | fr-FR | is-IS | it-IT | ja-JP | hi-IN | ko-KR | nb-NO | nl-NL | pl-PL | pt-BR | pt-PT | ro-RO | ru-RU | sv-SE | tr-TR,
  LexiconNames: [
    'STRING_VALUE',
    /* more items */
  ],
  OutputS3KeyPrefix: 'STRING_VALUE',
  SampleRate: 'STRING_VALUE',
  SnsTopicArn: 'STRING_VALUE',
  SpeechMarkTypes: [
    sentence | ssml | viseme | word,
    /* more items */
  ],
  TextType: ssml | text
};
polly.startSpeechSynthesisTask(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LexiconNames — (Array<String>)

      List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice.

    • OutputFormat — (String)

      The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

      Possible values include:
      • "json"
      • "mp3"
      • "ogg_vorbis"
      • "pcm"
    • OutputS3BucketName — (String)

      Amazon S3 bucket name to which the output file will be saved.

    • OutputS3KeyPrefix — (String)

      The Amazon S3 key prefix for the output speech file.

    • SampleRate — (String)

      The audio frequency specified in Hz.

      The valid values for mp3 and ogg_vorbis are "8000", "16000", and "22050". The default value is "22050".

      Valid values for pcm are "8000" and "16000" The default value is "16000".

    • SnsTopicArn — (String)

      ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.

    • SpeechMarkTypes — (Array<String>)

      The type of speech marks returned for the input text.

    • Text — (String)

      The input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.

    • TextType — (String)

      Specifies whether the input text is plain text or SSML. The default value is plain text.

      Possible values include:
      • "ssml"
      • "text"
    • VoiceId — (String)

      Voice ID to use for the synthesis.

      Possible values include:
      • "Aditi"
      • "Amy"
      • "Astrid"
      • "Bianca"
      • "Brian"
      • "Carla"
      • "Carmen"
      • "Celine"
      • "Chantal"
      • "Conchita"
      • "Cristiano"
      • "Dora"
      • "Emma"
      • "Enrique"
      • "Ewa"
      • "Filiz"
      • "Geraint"
      • "Giorgio"
      • "Gwyneth"
      • "Hans"
      • "Ines"
      • "Ivy"
      • "Jacek"
      • "Jan"
      • "Joanna"
      • "Joey"
      • "Justin"
      • "Karl"
      • "Kendra"
      • "Kimberly"
      • "Lea"
      • "Liv"
      • "Lotte"
      • "Lucia"
      • "Mads"
      • "Maja"
      • "Marlene"
      • "Mathieu"
      • "Matthew"
      • "Maxim"
      • "Mia"
      • "Miguel"
      • "Mizuki"
      • "Naja"
      • "Nicole"
      • "Penelope"
      • "Raveena"
      • "Ricardo"
      • "Ruben"
      • "Russell"
      • "Salli"
      • "Seoyeon"
      • "Takumi"
      • "Tatyana"
      • "Vicki"
      • "Vitoria"
      • "Zeina"
      • "Zhiyu"
    • LanguageCode — (String)

      Optional language code for the Speech Synthesis request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).

      If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.

      Possible values include:
      • "arb"
      • "cmn-CN"
      • "cy-GB"
      • "da-DK"
      • "de-DE"
      • "en-AU"
      • "en-GB"
      • "en-GB-WLS"
      • "en-IN"
      • "en-US"
      • "es-ES"
      • "es-MX"
      • "es-US"
      • "fr-CA"
      • "fr-FR"
      • "is-IS"
      • "it-IT"
      • "ja-JP"
      • "hi-IN"
      • "ko-KR"
      • "nb-NO"
      • "nl-NL"
      • "pl-PL"
      • "pt-BR"
      • "pt-PT"
      • "ro-RO"
      • "ru-RU"
      • "sv-SE"
      • "tr-TR"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • SynthesisTask — (map)

        SynthesisTask object that provides information and attributes about a newly submitted speech synthesis task.

        • TaskId — (String)

          The Amazon Polly generated identifier for a speech synthesis task.

        • TaskStatus — (String)

          Current status of the individual speech synthesis task.

          Possible values include:
          • "scheduled"
          • "inProgress"
          • "completed"
          • "failed"
        • TaskStatusReason — (String)

          Reason for the current status of a specific speech synthesis task, including errors if the task has failed.

        • OutputUri — (String)

          Pathway for the output speech file.

        • CreationTime — (Date)

          Timestamp for the time the synthesis task was started.

        • RequestCharacters — (Integer)

          Number of billable characters synthesized.

        • SnsTopicArn — (String)

          ARN for the SNS topic optionally used for providing status notification for a speech synthesis task.

        • LexiconNames — (Array<String>)

          List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice.

        • OutputFormat — (String)

          The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

          Possible values include:
          • "json"
          • "mp3"
          • "ogg_vorbis"
          • "pcm"
        • SampleRate — (String)

          The audio frequency specified in Hz.

          The valid values for mp3 and ogg_vorbis are "8000", "16000", and "22050". The default value is "22050".

          Valid values for pcm are "8000" and "16000" The default value is "16000".

        • SpeechMarkTypes — (Array<String>)

          The type of speech marks returned for the input text.

        • TextType — (String)

          Specifies whether the input text is plain text or SSML. The default value is plain text.

          Possible values include:
          • "ssml"
          • "text"
        • VoiceId — (String)

          Voice ID to use for the synthesis.

          Possible values include:
          • "Aditi"
          • "Amy"
          • "Astrid"
          • "Bianca"
          • "Brian"
          • "Carla"
          • "Carmen"
          • "Celine"
          • "Chantal"
          • "Conchita"
          • "Cristiano"
          • "Dora"
          • "Emma"
          • "Enrique"
          • "Ewa"
          • "Filiz"
          • "Geraint"
          • "Giorgio"
          • "Gwyneth"
          • "Hans"
          • "Ines"
          • "Ivy"
          • "Jacek"
          • "Jan"
          • "Joanna"
          • "Joey"
          • "Justin"
          • "Karl"
          • "Kendra"
          • "Kimberly"
          • "Lea"
          • "Liv"
          • "Lotte"
          • "Lucia"
          • "Mads"
          • "Maja"
          • "Marlene"
          • "Mathieu"
          • "Matthew"
          • "Maxim"
          • "Mia"
          • "Miguel"
          • "Mizuki"
          • "Naja"
          • "Nicole"
          • "Penelope"
          • "Raveena"
          • "Ricardo"
          • "Ruben"
          • "Russell"
          • "Salli"
          • "Seoyeon"
          • "Takumi"
          • "Tatyana"
          • "Vicki"
          • "Vitoria"
          • "Zeina"
          • "Zhiyu"
        • LanguageCode — (String)

          Optional language code for a synthesis task. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).

          If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.

          Possible values include:
          • "arb"
          • "cmn-CN"
          • "cy-GB"
          • "da-DK"
          • "de-DE"
          • "en-AU"
          • "en-GB"
          • "en-GB-WLS"
          • "en-IN"
          • "en-US"
          • "es-ES"
          • "es-MX"
          • "es-US"
          • "fr-CA"
          • "fr-FR"
          • "is-IS"
          • "it-IT"
          • "ja-JP"
          • "hi-IN"
          • "ko-KR"
          • "nb-NO"
          • "nl-NL"
          • "pl-PL"
          • "pt-BR"
          • "pt-PT"
          • "ro-RO"
          • "ru-RU"
          • "sv-SE"
          • "tr-TR"

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.

synthesizeSpeech(params = {}, callback) ⇒ AWS.Request

Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes. SSML input must be valid, well-formed SSML. Some alphabets might not be available with all the voices (for example, Cyrillic might not be read at all by English voices) unless phoneme mapping is used. For more information, see How it Works.

Service Reference:

Examples:

To synthesize speech


/* Synthesizes plain text or SSML into a file of human-like speech. */

 var params = {
  LexiconNames: [
     "example"
  ], 
  OutputFormat: "mp3", 
  SampleRate: "8000", 
  Text: "All Gaul is divided into three parts", 
  TextType: "text", 
  VoiceId: "Joanna"
 };
 polly.synthesizeSpeech(params, function(err, data) {
   if (err) console.log(err, err.stack); // an error occurred
   else     console.log(data);           // successful response
   /*
   data = {
    AudioStream: <Binary String>, 
    ContentType: "audio/mpeg", 
    RequestCharacters: 37
   }
   */
 });

Calling the synthesizeSpeech operation

var params = {
  OutputFormat: json | mp3 | ogg_vorbis | pcm, /* required */
  Text: 'STRING_VALUE', /* required */
  VoiceId: Aditi | Amy | Astrid | Bianca | Brian | Carla | Carmen | Celine | Chantal | Conchita | Cristiano | Dora | Emma | Enrique | Ewa | Filiz | Geraint | Giorgio | Gwyneth | Hans | Ines | Ivy | Jacek | Jan | Joanna | Joey | Justin | Karl | Kendra | Kimberly | Lea | Liv | Lotte | Lucia | Mads | Maja | Marlene | Mathieu | Matthew | Maxim | Mia | Miguel | Mizuki | Naja | Nicole | Penelope | Raveena | Ricardo | Ruben | Russell | Salli | Seoyeon | Takumi | Tatyana | Vicki | Vitoria | Zeina | Zhiyu, /* required */
  LanguageCode: arb | cmn-CN | cy-GB | da-DK | de-DE | en-AU | en-GB | en-GB-WLS | en-IN | en-US | es-ES | es-MX | es-US | fr-CA | fr-FR | is-IS | it-IT | ja-JP | hi-IN | ko-KR | nb-NO | nl-NL | pl-PL | pt-BR | pt-PT | ro-RO | ru-RU | sv-SE | tr-TR,
  LexiconNames: [
    'STRING_VALUE',
    /* more items */
  ],
  SampleRate: 'STRING_VALUE',
  SpeechMarkTypes: [
    sentence | ssml | viseme | word,
    /* more items */
  ],
  TextType: ssml | text
};
polly.synthesizeSpeech(params, function(err, data) {
  if (err) console.log(err, err.stack); // an error occurred
  else     console.log(data);           // successful response
});

Parameters:

  • params (Object) (defaults to: {})
    • LexiconNames — (Array<String>)

      List of one or more pronunciation lexicon names you want the service to apply during synthesis. Lexicons are applied only if the language of the lexicon is the same as the language of the voice. For information about storing lexicons, see PutLexicon.

    • OutputFormat — (String)

      The format in which the returned output will be encoded. For audio stream, this will be mp3, ogg_vorbis, or pcm. For speech marks, this will be json.

      When pcm is used, the content returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.

      Possible values include:
      • "json"
      • "mp3"
      • "ogg_vorbis"
      • "pcm"
    • SampleRate — (String)

      The audio frequency specified in Hz.

      The valid values for mp3 and ogg_vorbis are "8000", "16000", and "22050". The default value is "22050".

      Valid values for pcm are "8000" and "16000" The default value is "16000".

    • SpeechMarkTypes — (Array<String>)

      The type of speech marks returned for the input text.

    • Text — (String)

      Input text to synthesize. If you specify ssml as the TextType, follow the SSML format for the input text.

    • TextType — (String)

      Specifies whether the input text is plain text or SSML. The default value is plain text. For more information, see Using SSML.

      Possible values include:
      • "ssml"
      • "text"
    • VoiceId — (String)

      Voice ID to use for the synthesis. You can get a list of available voice IDs by calling the DescribeVoices operation.

      Possible values include:
      • "Aditi"
      • "Amy"
      • "Astrid"
      • "Bianca"
      • "Brian"
      • "Carla"
      • "Carmen"
      • "Celine"
      • "Chantal"
      • "Conchita"
      • "Cristiano"
      • "Dora"
      • "Emma"
      • "Enrique"
      • "Ewa"
      • "Filiz"
      • "Geraint"
      • "Giorgio"
      • "Gwyneth"
      • "Hans"
      • "Ines"
      • "Ivy"
      • "Jacek"
      • "Jan"
      • "Joanna"
      • "Joey"
      • "Justin"
      • "Karl"
      • "Kendra"
      • "Kimberly"
      • "Lea"
      • "Liv"
      • "Lotte"
      • "Lucia"
      • "Mads"
      • "Maja"
      • "Marlene"
      • "Mathieu"
      • "Matthew"
      • "Maxim"
      • "Mia"
      • "Miguel"
      • "Mizuki"
      • "Naja"
      • "Nicole"
      • "Penelope"
      • "Raveena"
      • "Ricardo"
      • "Ruben"
      • "Russell"
      • "Salli"
      • "Seoyeon"
      • "Takumi"
      • "Tatyana"
      • "Vicki"
      • "Vitoria"
      • "Zeina"
      • "Zhiyu"
    • LanguageCode — (String)

      Optional language code for the Synthesize Speech request. This is only necessary if using a bilingual voice, such as Aditi, which can be used for either Indian English (en-IN) or Hindi (hi-IN).

      If a bilingual voice is used and no language code is specified, Amazon Polly will use the default language of the bilingual voice. The default language for any voice is the one returned by the DescribeVoices operation for the LanguageCode parameter. For example, if no language code is specified, Aditi will use Indian English rather than Hindi.

      Possible values include:
      • "arb"
      • "cmn-CN"
      • "cy-GB"
      • "da-DK"
      • "de-DE"
      • "en-AU"
      • "en-GB"
      • "en-GB-WLS"
      • "en-IN"
      • "en-US"
      • "es-ES"
      • "es-MX"
      • "es-US"
      • "fr-CA"
      • "fr-FR"
      • "is-IS"
      • "it-IT"
      • "ja-JP"
      • "hi-IN"
      • "ko-KR"
      • "nb-NO"
      • "nl-NL"
      • "pl-PL"
      • "pt-BR"
      • "pt-PT"
      • "ro-RO"
      • "ru-RU"
      • "sv-SE"
      • "tr-TR"

Callback (callback):

  • function(err, data) { ... }

    Called when a response from the service is returned. If a callback is not supplied, you must call AWS.Request.send() on the returned request object to initiate the request.

    Context (this):

    • (AWS.Response)

      the response object containing error, data properties, and the original request object.

    Parameters:

    • err (Error)

      the error object returned from the request. Set to null if the request is successful.

    • data (Object)

      the de-serialized data returned from the request. Set to null if a request error occurs. The data object has the following properties:

      • AudioStream — (Buffer(Node.js), Typed Array(Browser), ReadableStream)

        Stream containing the synthesized speech.

      • ContentType — (String)

        Specifies the type audio stream. This should reflect the OutputFormat parameter in your request.

        • If you request mp3 as the OutputFormat, the ContentType returned is audio/mpeg.

        • If you request ogg_vorbis as the OutputFormat, the ContentType returned is audio/ogg.

        • If you request pcm as the OutputFormat, the ContentType returned is audio/pcm in a signed 16-bit, 1 channel (mono), little-endian format.

        • If you request json as the OutputFormat, the ContentType returned is audio/json.

      • RequestCharacters — (Integer)

        Number of characters synthesized.

Returns:

  • (AWS.Request)

    a handle to the operation request for subsequent event callback registration.