From e7188e83d332be6b95175487a71df79107dbaf88 Mon Sep 17 00:00:00 2001 From: Jack Ngai Date: Mon, 29 Oct 2018 18:14:58 -0400 Subject: [PATCH] Added Voice Tag Added voice tag to allow using Amazon Polly voices --- index.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/index.js b/index.js index 3135839..988f7c5 100644 --- a/index.js +++ b/index.js @@ -241,6 +241,23 @@ Speech.prototype.partOfSpeech = function (options) { return this; }; +/** + * Creates and inserts a voice tag to select which Amazon Polly voice to use + * see https://developer.amazon.com/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html#voice + * @param options an object that has two properties: word and voice + * word being the text to insert and role represents the voice to use + * @returns {Speech} + */ +Speech.prototype.voice = function (options) { + this._present(options, "The object provided to Speech#voice(..) was invalid."); + this._present(options.word, "The word provided to Speech#voice(..) was null or undefined."); + var word = this._escape(options.word); + if (options.voice) { + this._elements.push("" + word + "") + } + return this; +}; + /** * Creates and inserts a phoneme tag. * see https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference#phoneme