ms_synthesize

0th

Percentile

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

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

output_format

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

Value

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

Note

The content is likely in a binary format and the output depends on the `output_format` chosen. For example, if the `output_format` is an `MP3`, then see below example

Aliases
  • ms_synthesize
Examples
# 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)
}

# }
Documentation reproduced from package mscstts, version 0.2.2, License: GPL-3

Community examples

Looks like there are no examples yet.