
Last chance! 50% off unlimited learning
Sale ends in
Get Microsoft Text To Speech (TTS) or Cognitive Services Token from API Key
ms_synthesize(script, token = NULL, api_key = NULL, gender = "Female",
language = "en-US", output_format = c("raw-16khz-16bit-mono-pcm",
"ssml-16khz-16bit-mono-tts", "audio-16khz-16kbps-mono-siren",
"riff-16khz-16kbps-mono-siren", "riff-16khz-16bit-mono-pcm",
"audio-16khz-128kbitrate-mono-mp3", "audio-16khz-64kbitrate-mono-mp3",
"audio-16khz-32kbitrate-mono-mp3"), ...)
A character vector of lines to be spoken
An authentication token, base-64 encoded usually from
get_ms_tts_token
. If not provided, will be created from
get_ms_tts_token
Microsoft Cognitive Services API key, if token is not provided.
Sex of the Speaker
Language to be spoken,
must be from ms_language_codes
Format of the output, see https://docs.microsoft.com/en-us/azure/cognitive-services/speech/api-reference-rest/bingvoiceoutput for more information
Additional arguments to send to POST
A list of the request, content, token, and `SSML`.
# NOT RUN {
if (have_ms_tts_key()) {
res = ms_synthesize(
script = "hey, how are you doing? I'm doing pretty good",
output_format = "audio-16khz-128kbitrate-mono-mp3")
tmp <- tempfile()
writeBin(res$content, con = tmp)
mp3 = tuneR::readMP3(tmp)
}
# }
Run the code above in your browser using DataLab