AWSPolly
Objective-C
@interface AWSPolly
Swift
class AWSPolly
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.
-
The service configuration used to instantiate this service client.
Warning
Once the client is instantiated, do not modify the configuration object. It may cause unspecified behaviors.Declaration
Objective-C
@property (nonatomic, strong, readonly) AWSServiceConfiguration *configuration
-
Returns the singleton service client. If the singleton object does not exist, the SDK instantiates the default service client with
defaultServiceConfiguration
from[AWSServiceManager defaultServiceManager]
. The reference to this object is maintained by the SDK, and you do not need to retain it manually.For example, set the default service configuration in
- application:didFinishLaunchingWithOptions:
Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId") let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider) AWSServiceManager.default().defaultServiceConfiguration = configuration return true
}
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:credentialsProvider]; [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration; return YES; }
Then call the following to get the default service client:
Swift
let Polly = AWSPolly.default()
Objective-C
AWSPolly *Polly = [AWSPolly defaultPolly];
Declaration
Objective-C
+ (nonnull instancetype)defaultPolly;
Swift
class func `default`() -> Self
Return Value
The default service client.
-
Creates a service client with the given service configuration and registers it for the key.
For example, set the default service configuration in
- application:didFinishLaunchingWithOptions:
Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId") let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) AWSPolly.register(with: configuration!, forKey: "USWest2Polly") return true
}
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider]; [AWSPolly registerPollyWithConfiguration:configuration forKey:@"USWest2Polly"]; return YES; }
Then call the following to get the service client:
Swift
let Polly = AWSPolly(forKey: "USWest2Polly")
Objective-C
AWSPolly *Polly = [AWSPolly PollyForKey:@"USWest2Polly"];
Warning
After calling this method, do not modify the configuration object. It may cause unspecified behaviors.
Declaration
Objective-C
+ (void)registerPollyWithConfiguration:(id)configuration forKey:(nonnull NSString *)key;
Swift
class func register(withConfiguration configuration: Any!, forKey key: String)
Parameters
configuration
A service configuration object.
key
A string to identify the service client.
-
Retrieves the service client associated with the key. You need to call
+ registerPollyWithConfiguration:forKey:
before invoking this method.For example, set the default service configuration in
- application:didFinishLaunchingWithOptions:
Swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "YourIdentityPoolId") let configuration = AWSServiceConfiguration(region: .USWest2, credentialsProvider: credentialProvider) AWSPolly.register(with: configuration!, forKey: "USWest2Polly") return true
}
Objective-C
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YourIdentityPoolId"]; AWSServiceConfiguration *configuration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSWest2 credentialsProvider:credentialsProvider]; [AWSPolly registerPollyWithConfiguration:configuration forKey:@"USWest2Polly"]; return YES; }
Then call the following to get the service client:
Swift
let Polly = AWSPolly(forKey: "USWest2Polly")
Objective-C
AWSPolly *Polly = [AWSPolly PollyForKey:@"USWest2Polly"];
Declaration
Objective-C
+ (nonnull instancetype)PollyForKey:(nonnull NSString *)key;
Swift
convenience init(forKey key: String)
Parameters
key
A string to identify the service client.
Return Value
An instance of the service client.
-
Removes the service client associated with the key and release it.
Warning
Before calling this method, make sure no method is running on this client.
Declaration
Objective-C
+ (void)removePollyForKey:(nonnull NSString *)key;
Swift
class func remove(forKey key: String)
Parameters
key
A string to identify the service client.
-
Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the
GetLexicon
orListLexicon
APIs.For more information, see Managing Lexicons.
See
AWSPollyDeleteLexiconInput
See
AWSPollyDeleteLexiconOutput
Declaration
Objective-C
- (id)deleteLexicon:(nonnull AWSPollyDeleteLexiconInput *)request;
Swift
func deleteLexicon(_ request: AWSPollyDeleteLexiconInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the DeleteLexicon service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyDeleteLexiconOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
. -
Deletes the specified pronunciation lexicon stored in an Amazon Web Services Region. A lexicon which has been deleted is not available for speech synthesis, nor is it possible to retrieve it using either the
GetLexicon
orListLexicon
APIs.For more information, see Managing Lexicons.
See
AWSPollyDeleteLexiconInput
See
AWSPollyDeleteLexiconOutput
Declaration
Objective-C
- (void)deleteLexicon:(nonnull AWSPollyDeleteLexiconInput *)request completionHandler:(void (^_Nullable)(AWSPollyDeleteLexiconOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func deleteLexicon(_ request: AWSPollyDeleteLexiconInput) async throws -> AWSPollyDeleteLexiconOutput
Parameters
request
A container for the necessary parameters to execute the DeleteLexicon service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
. -
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 byDescribeVoices
.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.See
AWSPollyDescribeVoicesInput
See
AWSPollyDescribeVoicesOutput
Declaration
Objective-C
- (id)describeVoices:(nonnull AWSPollyDescribeVoicesInput *)request;
Swift
func describeVoices(_ request: AWSPollyDescribeVoicesInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the DescribeVoices service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyDescribeVoicesOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidNextToken
,AWSPollyErrorServiceFailure
. -
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 byDescribeVoices
.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.See
AWSPollyDescribeVoicesInput
See
AWSPollyDescribeVoicesOutput
Declaration
Objective-C
- (void)describeVoices:(nonnull AWSPollyDescribeVoicesInput *)request completionHandler: (void (^_Nullable)(AWSPollyDescribeVoicesOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func describeVoices(_ request: AWSPollyDescribeVoicesInput) async throws -> AWSPollyDescribeVoicesOutput
Parameters
request
A container for the necessary parameters to execute the DescribeVoices service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidNextToken
,AWSPollyErrorServiceFailure
. -
Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
See
AWSPollyGetLexiconInput
See
AWSPollyGetLexiconOutput
Declaration
Objective-C
- (id)getLexicon:(nonnull AWSPollyGetLexiconInput *)request;
Swift
func getLexicon(_ request: AWSPollyGetLexiconInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the GetLexicon service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyGetLexiconOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
. -
Returns the content of the specified pronunciation lexicon stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
See
AWSPollyGetLexiconInput
See
AWSPollyGetLexiconOutput
Declaration
Objective-C
- (void)getLexicon:(nonnull AWSPollyGetLexiconInput *)request completionHandler:(void (^_Nullable)(AWSPollyGetLexiconOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func lexicon(_ request: AWSPollyGetLexiconInput) async throws -> AWSPollyGetLexiconOutput
Parameters
request
A container for the necessary parameters to execute the GetLexicon service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
. -
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.
See
AWSPollyGetSpeechSynthesisTaskInput
See
AWSPollyGetSpeechSynthesisTaskOutput
Declaration
Objective-C
- (id)getSpeechSynthesisTask: (nonnull AWSPollyGetSpeechSynthesisTaskInput *)request;
Swift
func getSpeechSynthesisTask(_ request: AWSPollyGetSpeechSynthesisTaskInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the GetSpeechSynthesisTask service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyGetSpeechSynthesisTaskOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidTaskId
,AWSPollyErrorServiceFailure
,AWSPollyErrorSynthesisTaskNotFound
. -
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.
See
AWSPollyGetSpeechSynthesisTaskInput
See
AWSPollyGetSpeechSynthesisTaskOutput
Declaration
Objective-C
- (void) getSpeechSynthesisTask: (nonnull AWSPollyGetSpeechSynthesisTaskInput *)request completionHandler: (void (^_Nullable)(AWSPollyGetSpeechSynthesisTaskOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func speechSynthesisTask(_ request: AWSPollyGetSpeechSynthesisTaskInput) async throws -> AWSPollyGetSpeechSynthesisTaskOutput
Parameters
request
A container for the necessary parameters to execute the GetSpeechSynthesisTask service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidTaskId
,AWSPollyErrorServiceFailure
,AWSPollyErrorSynthesisTaskNotFound
. -
Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
See
AWSPollyListLexiconsInput
See
AWSPollyListLexiconsOutput
Declaration
Objective-C
- (id)listLexicons:(nonnull AWSPollyListLexiconsInput *)request;
Swift
func listLexicons(_ request: AWSPollyListLexiconsInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the ListLexicons service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyListLexiconsOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidNextToken
,AWSPollyErrorServiceFailure
. -
Returns a list of pronunciation lexicons stored in an Amazon Web Services Region. For more information, see Managing Lexicons.
See
AWSPollyListLexiconsInput
See
AWSPollyListLexiconsOutput
Declaration
Objective-C
- (void)listLexicons:(nonnull AWSPollyListLexiconsInput *)request completionHandler:(void (^_Nullable)(AWSPollyListLexiconsOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func listLexicons(_ request: AWSPollyListLexiconsInput) async throws -> AWSPollyListLexiconsOutput
Parameters
request
A container for the necessary parameters to execute the ListLexicons service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidNextToken
,AWSPollyErrorServiceFailure
. -
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.
See
AWSPollyListSpeechSynthesisTasksInput
See
AWSPollyListSpeechSynthesisTasksOutput
Declaration
Objective-C
- (id)listSpeechSynthesisTasks: (nonnull AWSPollyListSpeechSynthesisTasksInput *)request;
Swift
func listSpeechSynthesisTasks(_ request: AWSPollyListSpeechSynthesisTasksInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the ListSpeechSynthesisTasks service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyListSpeechSynthesisTasksOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidNextToken
,AWSPollyErrorServiceFailure
. -
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.
See
AWSPollyListSpeechSynthesisTasksInput
See
AWSPollyListSpeechSynthesisTasksOutput
Declaration
Objective-C
- (void)listSpeechSynthesisTasks: (nonnull AWSPollyListSpeechSynthesisTasksInput *)request completionHandler: (void (^_Nullable)( AWSPollyListSpeechSynthesisTasksOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func listSpeechSynthesisTasks(_ request: AWSPollyListSpeechSynthesisTasksInput) async throws -> AWSPollyListSpeechSynthesisTasksOutput
Parameters
request
A container for the necessary parameters to execute the ListSpeechSynthesisTasks service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidNextToken
,AWSPollyErrorServiceFailure
. -
Stores a pronunciation lexicon in an Amazon Web Services 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.
See
AWSPollyPutLexiconInput
See
AWSPollyPutLexiconOutput
Declaration
Objective-C
- (id)putLexicon:(nonnull AWSPollyPutLexiconInput *)request;
Swift
func putLexicon(_ request: AWSPollyPutLexiconInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the PutLexicon service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyPutLexiconOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidLexicon
,AWSPollyErrorUnsupportedPlsAlphabet
,AWSPollyErrorUnsupportedPlsLanguage
,AWSPollyErrorLexiconSizeExceeded
,AWSPollyErrorMaxLexemeLengthExceeded
,AWSPollyErrorMaxLexiconsNumberExceeded
,AWSPollyErrorServiceFailure
. -
Stores a pronunciation lexicon in an Amazon Web Services 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.
See
AWSPollyPutLexiconInput
See
AWSPollyPutLexiconOutput
Declaration
Objective-C
- (void)putLexicon:(nonnull AWSPollyPutLexiconInput *)request completionHandler:(void (^_Nullable)(AWSPollyPutLexiconOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func putLexicon(_ request: AWSPollyPutLexiconInput) async throws -> AWSPollyPutLexiconOutput
Parameters
request
A container for the necessary parameters to execute the PutLexicon service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorInvalidLexicon
,AWSPollyErrorUnsupportedPlsAlphabet
,AWSPollyErrorUnsupportedPlsLanguage
,AWSPollyErrorLexiconSizeExceeded
,AWSPollyErrorMaxLexemeLengthExceeded
,AWSPollyErrorMaxLexiconsNumberExceeded
,AWSPollyErrorServiceFailure
. -
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
andSnsTopicArn
). Once the synthesis task is created, this operation will return aSpeechSynthesisTask
object, which will include an identifier of this task as well as the current status. TheSpeechSynthesisTask
object is available for 72 hours after starting the asynchronous synthesis task.See
AWSPollyStartSpeechSynthesisTaskInput
See
AWSPollyStartSpeechSynthesisTaskOutput
Declaration
Objective-C
- (id)startSpeechSynthesisTask: (nonnull AWSPollyStartSpeechSynthesisTaskInput *)request;
Swift
func startSpeechSynthesisTask(_ request: AWSPollyStartSpeechSynthesisTaskInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the StartSpeechSynthesisTask service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollyStartSpeechSynthesisTaskOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorTextLengthExceeded
,AWSPollyErrorInvalidS3Bucket
,AWSPollyErrorInvalidS3Key
,AWSPollyErrorInvalidSampleRate
,AWSPollyErrorInvalidSnsTopicArn
,AWSPollyErrorInvalidSsml
,AWSPollyErrorEngineNotSupported
,AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
,AWSPollyErrorMarksNotSupportedForFormat
,AWSPollyErrorSsmlMarksNotSupportedForTextType
,AWSPollyErrorLanguageNotSupported
. -
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
andSnsTopicArn
). Once the synthesis task is created, this operation will return aSpeechSynthesisTask
object, which will include an identifier of this task as well as the current status. TheSpeechSynthesisTask
object is available for 72 hours after starting the asynchronous synthesis task.See
AWSPollyStartSpeechSynthesisTaskInput
See
AWSPollyStartSpeechSynthesisTaskOutput
Declaration
Objective-C
- (void)startSpeechSynthesisTask: (nonnull AWSPollyStartSpeechSynthesisTaskInput *)request completionHandler: (void (^_Nullable)( AWSPollyStartSpeechSynthesisTaskOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func startSpeechSynthesisTask(_ request: AWSPollyStartSpeechSynthesisTaskInput) async throws -> AWSPollyStartSpeechSynthesisTaskOutput
Parameters
request
A container for the necessary parameters to execute the StartSpeechSynthesisTask service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorTextLengthExceeded
,AWSPollyErrorInvalidS3Bucket
,AWSPollyErrorInvalidS3Key
,AWSPollyErrorInvalidSampleRate
,AWSPollyErrorInvalidSnsTopicArn
,AWSPollyErrorInvalidSsml
,AWSPollyErrorEngineNotSupported
,AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
,AWSPollyErrorMarksNotSupportedForFormat
,AWSPollyErrorSsmlMarksNotSupportedForTextType
,AWSPollyErrorLanguageNotSupported
. -
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.
See
AWSPollySynthesizeSpeechInput
See
AWSPollySynthesizeSpeechOutput
Declaration
Objective-C
- (id)synthesizeSpeech:(nonnull AWSPollySynthesizeSpeechInput *)request;
Swift
func synthesizeSpeech(_ request: AWSPollySynthesizeSpeechInput) -> Any!
Parameters
request
A container for the necessary parameters to execute the SynthesizeSpeech service method.
Return Value
An instance of
AWSTask
. On successful execution,task.result
will contain an instance ofAWSPollySynthesizeSpeechOutput
. On failed execution,task.error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorTextLengthExceeded
,AWSPollyErrorInvalidSampleRate
,AWSPollyErrorInvalidSsml
,AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
,AWSPollyErrorMarksNotSupportedForFormat
,AWSPollyErrorSsmlMarksNotSupportedForTextType
,AWSPollyErrorLanguageNotSupported
,AWSPollyErrorEngineNotSupported
. -
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.
See
AWSPollySynthesizeSpeechInput
See
AWSPollySynthesizeSpeechOutput
Declaration
Objective-C
- (void)synthesizeSpeech:(nonnull AWSPollySynthesizeSpeechInput *)request completionHandler: (void (^_Nullable)(AWSPollySynthesizeSpeechOutput *_Nullable, NSError *_Nullable))completionHandler;
Swift
func synthesizeSpeech(_ request: AWSPollySynthesizeSpeechInput) async throws -> AWSPollySynthesizeSpeechOutput
Parameters
request
A container for the necessary parameters to execute the SynthesizeSpeech service method.
completionHandler
The completion handler to call when the load request is complete.
response
- A response object, ornil
if the request failed.error
- An error object that indicates why the request failed, ornil
if the request was successful. On failed execution,error
may contain anNSError
withAWSPollyErrorDomain
domain and the following error code:AWSPollyErrorTextLengthExceeded
,AWSPollyErrorInvalidSampleRate
,AWSPollyErrorInvalidSsml
,AWSPollyErrorLexiconNotFound
,AWSPollyErrorServiceFailure
,AWSPollyErrorMarksNotSupportedForFormat
,AWSPollyErrorSsmlMarksNotSupportedForTextType
,AWSPollyErrorLanguageNotSupported
,AWSPollyErrorEngineNotSupported
.