| Title: | Client for AWS Polly |
|---|---|
| Description: | A client for AWS Polly <http://aws.amazon.com/documentation/polly>, a speech synthesis service. |
| Authors: | Thomas J. Leeper [aut] (ORCID: <https://orcid.org/0000-0003-4097-6326>), Antoine Sachet [cre], John Muschelli [ctb] (ORCID: <https://orcid.org/0000-0001-6469-1750>) |
| Maintainer: | Antoine Sachet <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.1.6 |
| Built: | 2026-05-24 08:13:04 UTC |
| Source: | https://github.com/cloudyr/aws.polly |
Client for AWS Polly
This is a client for AWS Polly, a speech synthesis service.
Thomas J. Leeper <[email protected]>
List, put, and delete lexicons
get_lexicon(lexicon, token, ...) put_lexicon(lexicon, content, ...) delete_lexicon(lexicon, ...)get_lexicon(lexicon, token, ...) put_lexicon(lexicon, content, ...) delete_lexicon(lexicon, ...)
lexicon |
A character string specifying the name of a lexicon. If missing, a list of available lexicons is returned. |
token |
Optionally, a pagination token. |
... |
Additional arguments passed to |
content |
A character string containing the content of the PLS lexicon. |
Note: put_lexicon will overwrite an existing lexicon with the same name.
A list.
## Not run: list_lexicons() ## End(Not run)## Not run: list_lexicons() ## End(Not run)
Pass text to the synthesis API and return an audio file
get_synthesis( text, voice, format = c("mp3", "ogg_vorbis", "pcm"), rate = deprecated(), lexicon = deprecated(), ssml = FALSE, lexicon_names = NULL, sample_rate = NULL, engine = c("standard", "neural"), language = NULL, ... ) synthesize(text, voice, ...)get_synthesis( text, voice, format = c("mp3", "ogg_vorbis", "pcm"), rate = deprecated(), lexicon = deprecated(), ssml = FALSE, lexicon_names = NULL, sample_rate = NULL, engine = c("standard", "neural"), language = NULL, ... ) synthesize(text, voice, ...)
text |
Either a plain text character string (maximum 1500 characters) or
a character string containing SSML ( |
voice |
Name of an AWS Polly voice. See |
format |
Output file format: one of ''mp3'‘ (default), '’ogg_vorbis'' or ''pcm''. |
rate |
Deprecated. Use |
lexicon |
Deprecated. Use |
ssml |
A logical indicating whether |
lexicon_names |
Optional character vector (max length 5) specifying the
names of lexicons to apply during synthesis. See |
sample_rate |
Audio frequency in Hertz. One of '24000', '22050', '16000' or '8000'. If 'NULL' (default), 'AWS' will pick an appropriate value depending on the voice, engine and output format. |
engine |
Engine type: either ''standard'‘ (default) or '’neural''.
Not all voices support the neural engine, see |
language |
Optional language code. This is useful for bilingual voices. |
... |
Additional arguments passed to |
get_synthesis returns a raw vector (i.e., the bytes
representing the audio as the requested file format). synthesize is
a convenience wrapper around that, which returns an object of class
“Wave” (see Wave).
## Not run: hello <- synthesize("hello world!", voice = "Geraint") if (interactive() & require("tuneR")) { try(play(hello)) } ## End(Not run)## Not run: hello <- synthesize("hello world!", voice = "Geraint") if (interactive() & require("tuneR")) { try(play(hello)) } ## End(Not run)
Retrieve a list of available voices
list_voices( language = NULL, token = NULL, engine = NULL, include_additional_languages = FALSE, ... )list_voices( language = NULL, token = NULL, engine = NULL, include_additional_languages = FALSE, ... )
language |
Optional ISO 3166 country identification tag. If 'NULL', voices for all available languages are returned. |
token |
Optional pagination token. |
engine |
Optional engine name: '"standard"' or '"neural"'. If specified, only voices available for that engine are returned. |
... |
Additional arguments passed to |
include_additional_language |
Optional boolean specifying whether to return bilingual voices listing the requested language as an additional language (as opposed to their main default language). |
A data frame of available names.
## Not run: list_voices(language = "cy-GB") list_voices() ## End(Not run)## Not run: list_voices(language = "cy-GB") list_voices() ## End(Not run)
This is the workhorse function to execute calls to the Polly API.
pollyHTTP( action, query = list(), headers = list(), body = NULL, verb = c("GET", "POST", "PUT", "DELETE"), version = "v1", raw_response = if (verb == "POST") TRUE else FALSE, verbose = getOption("verbose", FALSE), region = Sys.getenv("AWS_DEFAULT_REGION", "us-east-1"), key = NULL, secret = NULL, session_token = NULL, ... )pollyHTTP( action, query = list(), headers = list(), body = NULL, verb = c("GET", "POST", "PUT", "DELETE"), version = "v1", raw_response = if (verb == "POST") TRUE else FALSE, verbose = getOption("verbose", FALSE), region = Sys.getenv("AWS_DEFAULT_REGION", "us-east-1"), key = NULL, secret = NULL, session_token = NULL, ... )
action |
A character string specifying the API action to take |
query |
An optional named list containing query string parameters and their character values. |
headers |
A list of headers to pass to the HTTP request. |
body |
A request body |
verb |
A character string specifying the HTTP verb to implement. |
version |
A character string specifying the API version. |
raw_response |
A logical indicating whether to return the raw response body. |
verbose |
A logical indicating whether to be verbose. Default is given by |
region |
A character string specifying an AWS region. See |
key |
A character string specifying an AWS Access Key. See |
secret |
A character string specifying an AWS Secret Key. See |
session_token |
Optionally, a character string specifying an AWS temporary Session Token to use in signing a request. See |
... |
Additional arguments passed to |
This function constructs and signs an Polly API request and returns the results thereof, or relevant debugging information in the case of error.
If successful, a named list. Otherwise, a data structure of class “aws-error” containing any error message(s) from AWS and information about the request attempt.
Thomas J. Leeper