get_synthesis {aws.polly} | R Documentation |
Synthesize Speech
Description
Pass text to the synthesis API and return an audio file
Usage
get_synthesis(
text,
voice,
format = c("mp3", "ogg_vorbis", "pcm"),
rate = c(22050, 16000, 8000),
lexicon = NULL,
ssml = FALSE,
...
)
synthesize(text, voice, ...)
Arguments
text |
Either a plain text character string (maximum 1500 characters) or a character string containing SSML ( |
voice |
A character string specifying the name of an AWS Polly voice. See |
format |
A character string specifying an output file format. |
rate |
An integer value specifying the audio frequency in Hertz. |
lexicon |
Optionally, a character vector (max length 5) specifying the names of lexicons to apply during synthesis. See |
ssml |
A logical indicating whether |
... |
Additional arguments passed to |
Value
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
).
Examples
## Not run:
hello <- synthesize("hello world!", voice = "Geraint")
if (interactive() & require("tuneR")) {
try(play(hello))
}
## End(Not run)