wiki2ssml
Advanced tools
Comparing version 0.2.8 to 0.2.9
{ | ||
"name": "wiki2ssml", | ||
"version": "0.2.8", | ||
"version": "0.2.9", | ||
"description": "Wiki2SSML provides the WikiVoice markup language used for fine-tuning synthesised voice.", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
@@ -74,4 +74,7 @@ [![Build Status](https://travis-ci.com/baxtree/wiki2ssml.svg?branch=master)](https://travis-ci.com/baxtree/wiki2ssml) ![Codecov](https://img.shields.io/codecov/c/github/baxtree/wiki2ssml) ![Node](https://img.shields.io/static/v1?label=node.js&message=≥6.4.0&color=green) [![GitHub license](https://img.shields.io/github/license/baxtree/wiki2ssml)](https://github.com/baxtree/wiki2ssml/blob/master/LICENSE) | ||
| [[ibmTransBreathiness:SCALE,ibmTransPitchRange:SCALE,ibmTransTimbre:SCALE|TEXT]] | Voice custom transformation | | ||
| [[voice:NAME|[[mstExprType:TYPE|TEXT]]]] | Voice-specific speaking style | | ||
| [[mstBackgroundAudio:URI,mstBackgroundAudioVolume:SCALE]] | Background audio and its volume | | ||
| [[mstBackgroundAudio:URI,mstBackgroundAudioFadeIn:SCALE,mstBackgroundAudioFadeOut:SCALE]] | Background audio with fade-in and fade-out | | ||
More details on canonical attribute values can be found at [Speech Synthesis Markup Language (SSML)](https://www.w3.org/TR/speech-synthesis/). For ranges of vendor-specific values please refer to their online documents. | ||
More details on canonical attribute values can be found at [Speech Synthesis Markup Language (SSML)](https://www.w3.org/TR/speech-synthesis/). For ranges of vendor-specific values please refer to their online documents. Each attribute name in camel case can be rewritten in kebab case (e.g., firstSecondThird <=> first-second-third). Non-vendor-specific attributes can be abbreviated into their first three letters. | ||
@@ -108,2 +111,2 @@ # parseToSsml(input, languageCode, options) | ||
</speak> | ||
``` | ||
``` |
@@ -7,4 +7,7 @@ "use strict"; | ||
const _EXTNS = { | ||
"mstts": "http://www.w3.org/2001/mstts" | ||
}; | ||
module.exports = (() => { | ||
try { | ||
@@ -19,5 +22,6 @@ var _parser = peg.generate(fs.readFileSync(__dirname + "/wikivoice.pegjs").toString()); | ||
return "<?xml version=\"1.0\" encoding=\"UTF-8\"?><speak version=\"" + version + "\" xmlns=\"http://www.w3.org/2001/10/synthesis\" " + | ||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + | ||
"xsi:schemaLocation=\"http://www.w3.org/2001/10/synthesis http://www.w3.org/TR/speech-synthesis/synthesis.xsd\" " + | ||
"xml:lang=\"" + language + "\">"; | ||
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + | ||
"xsi:schemaLocation=\"http://www.w3.org/2001/10/synthesis http://www.w3.org/TR/speech-synthesis/synthesis.xsd\" " + | ||
"{{EXTNS_PLACEHOLDER}}" + | ||
"xml:lang=\"" + language + "\">"; | ||
}; | ||
@@ -30,3 +34,9 @@ | ||
var _getSsmlAsString = (ssmlBody, language, options) => { | ||
var ssml = _getSsmlHead(language, options.version) + ssmlBody + _getSsmlTail(); | ||
var ext_ns = ""; | ||
for (var namespace in _EXTNS) { | ||
if (ssmlBody.indexOf("<" + namespace + ":") > -1) { | ||
ext_ns += "xmlns:" + namespace + "=\"" + _EXTNS[namespace] + "\" "; | ||
} | ||
} | ||
var ssml = _getSsmlHead(language, options.version).replace("{{EXTNS_PLACEHOLDER}}", ext_ns) + ssmlBody + _getSsmlTail(); | ||
if (options.pretty) { | ||
@@ -86,3 +96,2 @@ return prettifyXml(ssml, {indent: 2, newline: "\n"}); | ||
return { | ||
parseToSsml: _parseToSsml, | ||
@@ -89,0 +98,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
183471
926
110