Speech Markdown parser and formatters in TypeScript. Updated suppport for Amazon Polly
npm install speechmarkdown-amzn-polly-js[![TypeScript version][ts-badge]][typescript-34]
[![Node.js version][nodejs-badge]][nodejs]
[![MIT][license-badge]][LICENSE]
js
const smd = require('speechmarkdown-polly-js');
const markdown = Sample [3s] speech [250ms] markdown;
const options = {
platform: 'amazon-polly'
};
const speech = new smd.SpeechMarkdown();
const ssml = speech.toSSML(markdown, options);
`
The resulting SSML is:
`xml
Sample speech markdown
`
$3
Convert Speech Markdown to SSML for Amazon Alexa
`js
const smd = require('speechmarkdown-polly-js');
const markdown = Sample [3s] speech [250ms] markdown;
const options = {
platform: 'amazon-polly-neural'
};
const speech = new smd.SpeechMarkdown();
const ssml = speech.toSSML(markdown, options);
`
The resulting SSML is:
`xml
Sample speech markdown
`
$3
Convert Speech Markdown to Plain Text
`js
const smd = require('speechmarkdown-polly-js');
const markdown = Sample [3s] speech [250ms] markdown;
const options = {};
const speech = new smd.SpeechMarkdown();
const text = speech.toText(markdown, options);
`
The resulting text is:
`text
Sample speech markdown
`
More
$3
You can pass options into the constructor:
`js
const smd = require('speechmarkdown-polly-js');
const markdown = Sample [3s] speech [250ms] markdown;
const options = {
platform: 'amazon-polly'
};
const speech = new smd.SpeechMarkdown(options);
const ssml = speech.toSSML(markdown);
`
Or in the methods toSSML and toText:
`js
const smd = require('speechmarkdown-polly-js');
const markdown = Sample [3s] speech [250ms] markdown;
const options = {
platform: 'amazon-polly'
};
const speech = new smd.SpeechMarkdown();
const ssml = speech.toSSML(markdown, options);
`
Available options are:
* platform (string) - Determines the formatter to use to render SSML. Valid values are: amazon-polly and amazon-polly-neural.
* includeFormatterComment (boolean) - Adds an XML comment to the SSML output indicating the formatter used. Default is false.
* includeSpeakTag (boolean) - Determines if the tag will be rendered in the SSML output. Default is true.
* includeParagraphTag (boolean) - Determines if the tag will be rendered in the SSML output. Default is false`.