Travis build status AppVeyor Build Status Coverage status

mscstts Package:

The goal of mscstts is to provide an R Client for the Microsoft Cognitive Services Text to Speech REST API, including voice synthesis. A valid account MUST be registered at the Microsoft Cognitive Services website in order to obtain a (free) API key. Without an API key, this package will not work properly.

See the documentation here:

Getting an API key

You can get a TTS API key here: The API you need to get one from is Bing Speech. (This will be deprecated! See below)

  1. Create an Azure account
  2. Go to If that works, skip to step 5.
  3. Go to
  4. Click + Create a Resource
  5. Search “Speech”
  6. Hit + Create
  7. Should be able to create an F0 account (which is free - see below) if you hit the pricing tiers


You can install mscstts from GitHub with:

# install.packages("remotes")


if (ms_have_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("example", fileext = ".mp3")
  writeBin(res$content, con = tmp)
  mp3 = tuneR::readMP3(tmp)
testthat::expect_true(file.size(tmp) > 50000)
if (interactive()) {
  tuneR::play(mp3, player = "play")