R Client for the Microsoft Cognitive Services 'Text-to-Speech' REST API

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 < https://www.microsoft.com/cognitive-services/> in order to obtain a (free) API key. Without an API key, this package will not work properly.


Travis buildstatus AppVeyor BuildStatus Coveragestatus

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 https://www.microsoft.com/cognitive-services/ in order to obtain a (free) API key. Without an API key, this package will not work properly.

See the documentation here: https://docs.microsoft.com/en-us/azure/cognitive-services/speech/home

Getting an API key

You can get a TTS API key here: https://azure.microsoft.com/en-us/try/cognitive-services/. 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 https://portal.azure.com/#create/Microsoft.CognitiveServicesSpeechServices. If that works, skip to step 5.
  3. Go to https://portal.azure.com/#home
  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

Installation

You can install mscstts from GitHub with:

# install.packages("remotes")
remotes::install_github("muschellij2/mscstts")

Example

library(mscstts)
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")
}

News

mscstts 0.5.1

  • Added voice listing.
  • Added new output formats for audio that should be correct.

mscstts 0.5.0

  • Added ms_regions to allow for the region for tokens.
  • Now supports TTS proper, not really Bing.

mscstts 0.4.0

  • Added reveal code for tokens.
  • Added validate_language_gender.

mscstts 0.3.0

  • Refactoring some code.
  • Allow for escaping in SSML.
  • Separated validation code for language and gender combinations.

mscstts 0.2.2

  • CRAN submission.

mscstts 0.1.0

  • Added a NEWS.md file to track changes to the package.

  • First release, ms_synthesize is the main function.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("mscstts")

0.5.2 by John Muschelli, a month ago


https://github.com/muschellij2/mscstts


Report a bug at https://github.com/muschellij2/mscstts/issues


Browse source code at https://github.com/cran/mscstts


Authors: John Muschelli [aut, cre]


Documentation:   PDF Manual  


GPL-3 license


Imports httr, jsonlite, tuneR

Suggests knitr, rmarkdown, covr, testthat


Imported by text2speech.


See at CRAN