Speech

index.js

This class helps simplify using SSML (Speech Synthesis Markup Language). This only supports a subset of SSML tags which the Alexa device supports. An example of how to use this class. var speech = new Speech(); speech.say("Let's begin your lesson"); speech.pause("1s");

Implement a method for , , All done interpret-as="cardinal|ordinal|digits|fraction|unit|date|time|telephone|address" + format="mdy|dmy|ymd|md|dm|ym|my|d|m|y" All done
new Speech()
Instance Members
say(saying)
paragraph(paragraph)
sentence(saying)
pause(duration)
pauseByStrength(strength)
audio(url, callback)
spell(word)
spellSlowly(word, delay)
toObject()
ssml(excludeSpeakTag)
sayAs(options)
partOfSpeech(options)
phoneme(alphabet, ph, word)
_isFunction(fnc, name)
emphasis(level, word)
prosody(attributes, word)
sub(alias, word)
sayWithSSML(saying)

validateAttribute

index.js

This helper function consolidates the validation checks for rate,pitch and volume. It will first check to see if the attribute is present and whether it's one of the following conditions: a) the value of the attribute is a valid value or b) the value does not exist in the list, but passes the onCheck function. A hook for additional checks.

Upon passing the above checks, the onSuccessful function is called allowing the caller to do any additional work.

validateAttribute(obj: any, attribute: any, validList: any, onCheck: any, onSuccessful: any)
Parameters
obj (any) The object that owns the attribute.
attribute (any) The attribute name to check. e.g., rate, pitch or volume.
validList (any) The list of value values that the attribute can be.
onCheck (any) A hook for additional checks if the value does not exist in the list.
onSuccessful (any) A hook to call when all validation checks succeed.

checkRateRange

index.js

This method ensures that the value of the rate must be equal or great than 20%

checkRateRange(num: any)
Parameters
num (any) is the value of rate

isInList

index.js

This method validates if the value exists in the list of values

isInList(value: any, listOfValues: any, msg: any)
Parameters
value (any)
listOfValues (any)
msg (any) is the error message that will be thrown when the value is not in the list