Speech Synthesis Markdown (SSMD) is a lightweight alternative syntax for SSML. It's a node port of ruby ssmd
See specification of the language.
Node 8 or later
npm install ssmd
const ssmd = require('ssmd');
const ssml = ssmd("hello *SSMD*!");
console.log(ssml);
<speak>
hello <emphasis>SSMD</emphasis>!
</speak>
const config = {
outputSpeakTag: false,
prettyPrint: true,
headingLevels: {
1: [{
tag: "emphasis",
value: 'strong'
},
{
tag: "pause",
value: '300ms'
},
]
}
};
ssmd(`
# My first heading 1
Hello world
`,
config
)
<s>
<emphasis level='strong'>
My first heading 1
</emphasis>
<break time=\'300ms\'/>
</s>
<s>
Hello world
</s>
outputSpeakTag
(Boolean, default=true
) Set it to false if you don't want to have tags included.prettyPrint
(String, default=true
) Indent the resulting ssml.headingLevels
(Object) Customize the way heading tags will be transformed into SSML, default value is specified in specification.md
Note:
This version is still under development. See below which essential SSML constructs are implemented so far:
- Text
- Emphasis
- Break
- Language
- Mark
- Paragraph
- Sentence
- Phoneme
- Prosody
- Say-as
- Substitution
- Audio
- Extensions
Run npm test
to run the tests against a given executable.
This implementation and any other can be tested against the SSMD specification.
Said specification is extracted from SPECIFICATION.md
.
It runs each SSMD snippet through the tested tool and compares it to the output of
the following SSML snippet. If they match the test passes.
Bug reports and pull requests are welcome on GitHub at https://github.com/fabien88/ssmd. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The module is available as open source under the terms of the MIT License.