mscstts (version 0.2.2)

ms_synthesize: Get Microsoft Text To Speech (TTS) or Cognitive Services Token from API Key

Description

Get Microsoft Text To Speech (TTS) or Cognitive Services Token from API Key

Usage

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"), ...)

Arguments

script

A character vector of lines to be spoken

token

An authentication token, base-64 encoded usually from get_ms_tts_token. If not provided, will be created from get_ms_tts_token

api_key

Microsoft Cognitive Services API key, if token is not provided.

gender

Sex of the Speaker

language

Language to be spoken, must be from ms_language_codes

...

Additional arguments to send to POST

Value

A list of the request, content, token, and `SSML`.

Examples

Run this code
# 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 DataCamp Workspace