AutoCloseable
@Generated("software.amazon.awssdk:codegen") public interface PollyClient extends AutoCloseable
builder()
method.
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.
Modifier and Type | Field | Description |
---|---|---|
static String |
SERVICE_NAME |
Modifier and Type | Method | Description |
---|---|---|
static PollyClientBuilder |
builder() |
Create a builder that can be used to configure and create a
PollyClient . |
static PollyClient |
create() |
Create a
PollyClient with the region loaded from the
DefaultAwsRegionProviderChain and credentials loaded from the
DefaultCredentialsProvider . |
default DeleteLexiconResponse |
deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) |
Deletes the specified pronunciation lexicon stored in an AWS Region.
|
default DescribeVoicesResponse |
describeVoices(DescribeVoicesRequest describeVoicesRequest) |
Returns the list of voices that are available for use when requesting speech synthesis.
|
default GetLexiconResponse |
getLexicon(GetLexiconRequest getLexiconRequest) |
Returns the content of the specified pronunciation lexicon stored in an AWS Region.
|
default ListLexiconsResponse |
listLexicons(ListLexiconsRequest listLexiconsRequest) |
Returns a list of pronunciation lexicons stored in an AWS Region.
|
PollyClientPresigners |
presigners() |
|
default PutLexiconResponse |
putLexicon(PutLexiconRequest putLexiconRequest) |
Stores a pronunciation lexicon in an AWS Region.
|
static ServiceMetadata |
serviceMetadata() |
|
default <ReturnT> ReturnT |
synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest,
StreamingResponseHandler streamingHandler) |
Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.
|
close
static final String SERVICE_NAME
static PollyClient create()
PollyClient
with the region loaded from the
DefaultAwsRegionProviderChain
and credentials loaded from the
DefaultCredentialsProvider
.static PollyClientBuilder builder()
PollyClient
.default DeleteLexiconResponse deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) throws LexiconNotFoundException, ServiceFailureException, SdkBaseException, SdkClientException, PollyException
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.
deleteLexiconRequest
- LexiconNotFoundException
- Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
name is misspelled or specifying a lexicon that is in a different region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
ServiceFailureException
- An unknown condition has caused a service failure.SdkBaseException
- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException
- If any client side error occurs such as an IO related failure, failure to get credentials, etc)PollyException
- Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this typedefault DescribeVoicesResponse describeVoices(DescribeVoicesRequest describeVoicesRequest) throws InvalidNextTokenException, ServiceFailureException, SdkBaseException, SdkClientException, PollyException
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.
describeVoicesRequest
- InvalidNextTokenException
- The NextToken is invalid. Verify that it's spelled correctly, and then try again.ServiceFailureException
- An unknown condition has caused a service failure.SdkBaseException
- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException
- If any client side error occurs such as an IO related failure, failure to get credentials, etc)PollyException
- Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this typedefault GetLexiconResponse getLexicon(GetLexiconRequest getLexiconRequest) throws LexiconNotFoundException, ServiceFailureException, SdkBaseException, SdkClientException, PollyException
Returns the content of the specified pronunciation lexicon stored in an AWS Region. For more information, see Managing Lexicons.
getLexiconRequest
- LexiconNotFoundException
- Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
name is misspelled or specifying a lexicon that is in a different region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
ServiceFailureException
- An unknown condition has caused a service failure.SdkBaseException
- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException
- If any client side error occurs such as an IO related failure, failure to get credentials, etc)PollyException
- Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this typedefault ListLexiconsResponse listLexicons(ListLexiconsRequest listLexiconsRequest) throws InvalidNextTokenException, ServiceFailureException, SdkBaseException, SdkClientException, PollyException
Returns a list of pronunciation lexicons stored in an AWS Region. For more information, see Managing Lexicons.
listLexiconsRequest
- InvalidNextTokenException
- The NextToken is invalid. Verify that it's spelled correctly, and then try again.ServiceFailureException
- An unknown condition has caused a service failure.SdkBaseException
- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException
- If any client side error occurs such as an IO related failure, failure to get credentials, etc)PollyException
- Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this typedefault PutLexiconResponse putLexicon(PutLexiconRequest putLexiconRequest) throws InvalidLexiconException, UnsupportedPlsAlphabetException, UnsupportedPlsLanguageException, LexiconSizeExceededException, MaxLexemeLengthExceededException, MaxLexiconsNumberExceededException, ServiceFailureException, SdkBaseException, SdkClientException, PollyException
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.
putLexiconRequest
- InvalidLexiconException
- Amazon Polly can't find the specified lexicon. Verify that the lexicon's name is spelled correctly, and
then try again.UnsupportedPlsAlphabetException
- The alphabet specified by the lexicon is not a supported alphabet. Valid values are x-sampa
and ipa
.UnsupportedPlsLanguageException
- The language specified in the lexicon is unsupported. For a list of supported languages, see Lexicon Attributes.LexiconSizeExceededException
- The maximum size of the specified lexicon would be exceeded by this operation.MaxLexemeLengthExceededException
- The maximum size of the lexeme would be exceeded by this operation.MaxLexiconsNumberExceededException
- The maximum number of lexicons would be exceeded by this operation.ServiceFailureException
- An unknown condition has caused a service failure.SdkBaseException
- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException
- If any client side error occurs such as an IO related failure, failure to get credentials, etc)PollyException
- Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this typedefault <ReturnT> ReturnT synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest, StreamingResponseHandler streamingHandler) throws TextLengthExceededException, InvalidSampleRateException, InvalidSsmlException, LexiconNotFoundException, ServiceFailureException, MarksNotSupportedForFormatException, SsmlMarksNotSupportedForTextTypeException, SdkBaseException, SdkClientException, PollyException
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.
synthesizeSpeechRequest
- streamingHandler
- Functional interface for processing the streamed response content. The unmarshalled
SynthesizeSpeechResponse and an InputStream to the response content are provided as parameters to the
callback. The callback may return a transformed type which will be the return value of this method. See
software.amazon.awssdk.runtime.transform.StreamingResponseHandler
for details on implementing this
interface and for links to precanned implementations for common scenarios like downloading to a file. The
service documentation for the response content is as follows '
Stream containing the synthesized speech.
'.TextLengthExceededException
- The value of the "Text" parameter is longer than the accepted limits. The limit for input text is a
maximum of 3000 characters total, of which no more than 1500 can be billed characters. SSML tags are not
counted as billed characters.InvalidSampleRateException
- The specified sample rate is not valid.InvalidSsmlException
- The SSML you provided is invalid. Verify the SSML syntax, spelling of tags and values, and then try
again.LexiconNotFoundException
- Amazon Polly can't find the specified lexicon. This could be caused by a lexicon that is missing, its
name is misspelled or specifying a lexicon that is in a different region.
Verify that the lexicon exists, is in the region (see ListLexicons) and that you spelled its name is spelled correctly. Then try again.
ServiceFailureException
- An unknown condition has caused a service failure.MarksNotSupportedForFormatException
- Speech marks are not supported for the OutputFormat
selected. Speech marks are only
available for content in json
format.SsmlMarksNotSupportedForTextTypeException
- SSML speech marks are not supported for plain text-type input.SdkBaseException
- Base class for all exceptions that can be thrown by the SDK (both service and client). Can be used for
catch all scenarios.SdkClientException
- If any client side error occurs such as an IO related failure, failure to get credentials, etc)PollyException
- Base exception for all service exceptions. Unknown exceptions will be thrown as an instance of this typestatic ServiceMetadata serviceMetadata()
PollyClientPresigners presigners()
Copyright © 2017 Amazon Web Services, Inc. All Rights Reserved.