public class AmazonPollyClient extends AmazonWebServiceClient implements AmazonPolly
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.
LOGGING_AWS_REQUEST_METRIC
Constructor and Description |
---|
AmazonPollyClient()
Deprecated.
|
AmazonPollyClient(AWSCredentials awsCredentials)
Constructs a new client to invoke service methods on AmazonPolly using
the specified AWS account credentials.
|
AmazonPollyClient(AWSCredentials awsCredentials,
ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonPolly using
the specified AWS account credentials and client configuration options.
|
AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider)
Constructs a new client to invoke service methods on AmazonPolly using
the specified AWS account credentials provider.
|
AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration)
Constructs a new client to invoke service methods on AmazonPolly using
the specified AWS account credentials provider and client configuration
options.
|
AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
HttpClient httpClient)
Constructs a new client to invoke service methods on AmazonPolly using
the specified AWS account credentials provider, client configuration
options and request metric collector.
|
AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider,
ClientConfiguration clientConfiguration,
com.amazonaws.metrics.RequestMetricCollector requestMetricCollector)
Deprecated.
|
AmazonPollyClient(ClientConfiguration clientConfiguration)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
DeleteLexiconResult |
deleteLexicon(DeleteLexiconRequest deleteLexiconRequest)
Deletes the specified pronunciation lexicon stored in an AWS Region.
|
DescribeVoicesResult |
describeVoices(DescribeVoicesRequest describeVoicesRequest)
Returns the list of voices that are available for use when requesting
speech synthesis.
|
ResponseMetadata |
getCachedResponseMetadata(AmazonWebServiceRequest request)
Deprecated.
ResponseMetadata cache can hold up to 50 requests and
responses in memory and will cause memory issue. This method
now always returns null.
|
GetLexiconResult |
getLexicon(GetLexiconRequest getLexiconRequest)
Returns the content of the specified pronunciation lexicon stored in an
AWS Region.
|
GetSpeechSynthesisTaskResult |
getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest)
Retrieves a specific SpeechSynthesisTask object based on its TaskID.
|
ListLexiconsResult |
listLexicons(ListLexiconsRequest listLexiconsRequest)
Returns a list of pronunciation lexicons stored in an AWS Region.
|
ListSpeechSynthesisTasksResult |
listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest)
Returns a list of SpeechSynthesisTask objects ordered by their creation
date.
|
PutLexiconResult |
putLexicon(PutLexiconRequest putLexiconRequest)
Stores a pronunciation lexicon in an AWS Region.
|
StartSpeechSynthesisTaskResult |
startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest)
Allows the creation of an asynchronous synthesis task, by starting a new
SpeechSynthesisTask . |
SynthesizeSpeechResult |
synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest)
Synthesizes UTF-8 input, plain text or SSML, to a stream of bytes.
|
addRequestHandler, addRequestHandler, getEndpoint, getEndpointPrefix, getRegions, getRequestMetricsCollector, getServiceName, getSignerByURI, getSignerRegionOverride, getTimeOffset, removeRequestHandler, removeRequestHandler, setConfiguration, setEndpoint, setEndpoint, setRegion, setServiceNameIntern, setSignerRegionOverride, setTimeOffset, shutdown, withTimeOffset
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
setEndpoint, setRegion, shutdown
@Deprecated public AmazonPollyClient()
All service calls made using this new client object are blocking, and will not return until the service call completes.
DefaultAWSCredentialsProviderChain
@Deprecated public AmazonPollyClient(ClientConfiguration clientConfiguration)
All service calls made using this new client object are blocking, and will not return until the service call completes.
clientConfiguration
- The client configuration options controlling
how this client connects to AmazonPolly (ex: proxy settings,
retry counts, etc.).DefaultAWSCredentialsProviderChain
public AmazonPollyClient(AWSCredentials awsCredentials)
The client requests are authenticated using the AWSCredentials
provided in this constructor. Static AWSCredentials can be passed for
quick testing. However, it is strongly recommended to use Amazon Cognito
vended temporary credentials for use in production. This can be achieved
by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonPollyClient client = new AmazonPollyClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentials
- The AWS credentials (access key ID and secret key)
to use when authenticating with AWS services.public AmazonPollyClient(AWSCredentials awsCredentials, ClientConfiguration clientConfiguration)
The client requests are authenticated using the AWSCredentials
provided in this constructor. Static AWSCredentials can be passed for
quick testing. However, it is strongly recommended to use Amazon Cognito
vended temporary credentials for use in production. This can be achieved
by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonPollyClient client = new AmazonPollyClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentials
- The AWS credentials (access key ID and secret key)
to use when authenticating with AWS services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonPolly (ex: proxy settings,
retry counts, etc.).public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonPollyClient client = new AmazonPollyClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonPollyClient client = new AmazonPollyClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonPolly (ex: proxy settings,
retry counts, etc.).@Deprecated public AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, com.amazonaws.metrics.RequestMetricCollector requestMetricCollector)
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonPolly (ex: proxy settings,
retry counts, etc.).requestMetricCollector
- optional request metric collectorpublic AmazonPollyClient(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, HttpClient httpClient)
The client requests are authenticated using the AWSCredentials
provided by the AWSCredentialsProvider
. Static AWSCredentials can
be passed for quick testing. However, it is strongly recommended to use
Amazon Cognito vended temporary credentials for use in production. This
can be achieved by using AWSMobileClient
. Please see
https://aws-amplify.github.io/docs/android/authentication for
instructions on how to enable AWSMobileClient
.
AWSMobileClient.getInstance().initialize(getApplicationContext(), new Callback<UserStateDetails>() { @Override public void onResult(final UserStateDetails details) { AmazonPollyClient client = new AmazonPollyClient(AWSMobileClient.getInstance()); } @Override public void onError(final Exception e) { e.printStackTrace(); } });
All service calls made using this new client object are blocking, and will not return until the service call completes.
awsCredentialsProvider
- The AWS credentials provider which will
provide credentials to authenticate requests with AWS
services.clientConfiguration
- The client configuration options controlling
how this client connects to AmazonPolly (ex: proxy settings,
retry counts, etc.).httpClient
- A http clientpublic DeleteLexiconResult deleteLexicon(DeleteLexiconRequest deleteLexiconRequest) throws AmazonServiceException, AmazonClientException
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.
deleteLexicon
in interface AmazonPolly
deleteLexiconRequest
- LexiconNotFoundException
ServiceFailureException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public DescribeVoicesResult describeVoices(DescribeVoicesRequest describeVoicesRequest) throws AmazonServiceException, AmazonClientException
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.
describeVoices
in interface AmazonPolly
describeVoicesRequest
- InvalidNextTokenException
ServiceFailureException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public GetLexiconResult getLexicon(GetLexiconRequest getLexiconRequest) throws AmazonServiceException, AmazonClientException
Returns the content of the specified pronunciation lexicon stored in an AWS Region. For more information, see Managing Lexicons.
getLexicon
in interface AmazonPolly
getLexiconRequest
- LexiconNotFoundException
ServiceFailureException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public GetSpeechSynthesisTaskResult getSpeechSynthesisTask(GetSpeechSynthesisTaskRequest getSpeechSynthesisTaskRequest) throws AmazonServiceException, AmazonClientException
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.
getSpeechSynthesisTask
in interface AmazonPolly
getSpeechSynthesisTaskRequest
- InvalidTaskIdException
ServiceFailureException
SynthesisTaskNotFoundException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public ListLexiconsResult listLexicons(ListLexiconsRequest listLexiconsRequest) throws AmazonServiceException, AmazonClientException
Returns a list of pronunciation lexicons stored in an AWS Region. For more information, see Managing Lexicons.
listLexicons
in interface AmazonPolly
listLexiconsRequest
- InvalidNextTokenException
ServiceFailureException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public ListSpeechSynthesisTasksResult listSpeechSynthesisTasks(ListSpeechSynthesisTasksRequest listSpeechSynthesisTasksRequest) throws AmazonServiceException, AmazonClientException
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.
listSpeechSynthesisTasks
in interface AmazonPolly
listSpeechSynthesisTasksRequest
- InvalidNextTokenException
ServiceFailureException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public PutLexiconResult putLexicon(PutLexiconRequest putLexiconRequest) throws AmazonServiceException, AmazonClientException
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.
putLexicon
in interface AmazonPolly
putLexiconRequest
- InvalidLexiconException
UnsupportedPlsAlphabetException
UnsupportedPlsLanguageException
LexiconSizeExceededException
MaxLexemeLengthExceededException
MaxLexiconsNumberExceededException
ServiceFailureException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public StartSpeechSynthesisTaskResult startSpeechSynthesisTask(StartSpeechSynthesisTaskRequest startSpeechSynthesisTaskRequest) throws AmazonServiceException, AmazonClientException
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.
startSpeechSynthesisTask
in interface AmazonPolly
startSpeechSynthesisTaskRequest
- TextLengthExceededException
InvalidS3BucketException
InvalidS3KeyException
InvalidSampleRateException
InvalidSnsTopicArnException
InvalidSsmlException
EngineNotSupportedException
LexiconNotFoundException
ServiceFailureException
MarksNotSupportedForFormatException
SsmlMarksNotSupportedForTextTypeException
LanguageNotSupportedException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.public SynthesizeSpeechResult synthesizeSpeech(SynthesizeSpeechRequest synthesizeSpeechRequest) throws AmazonServiceException, AmazonClientException
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.
synthesizeSpeech
in interface AmazonPolly
synthesizeSpeechRequest
- TextLengthExceededException
InvalidSampleRateException
InvalidSsmlException
LexiconNotFoundException
ServiceFailureException
MarksNotSupportedForFormatException
SsmlMarksNotSupportedForTextTypeException
LanguageNotSupportedException
EngineNotSupportedException
AmazonClientException
- If any internal errors are encountered
inside the client while attempting to make the request or
handle the response. For example if a network connection is
not available.AmazonServiceException
- If an error response is returned by Amazon
Polly indicating either a problem with the data in the
request, or a server side issue.@Deprecated public ResponseMetadata getCachedResponseMetadata(AmazonWebServiceRequest request)
Response metadata is only cached for a limited period of time, so if you need to access this extra diagnostic information for an executed request, you should use this method to retrieve it as soon as possible after executing the request.
getCachedResponseMetadata
in interface AmazonPolly
request
- The originally executed requestCopyright © 2018 Amazon Web Services, Inc. All Rights Reserved.