Nepotistic Pontifex Maximus
Wondering what’s next for npm?Check out our public roadmap! »


0.2.16 • Public • Published

Build Status Codecov Node GitHub license


wiki2ssml can transform the WikiVoice markups into the W3C SSML widely supported by various text-to-speech services as an interchange format for synthesised voice tuning.


wiki2ssml eases the burden of editors preparing scripts later used for speech synthesis. It is powered by WikiVoice which provides an unobtrusive solution of blending voice-tuning markups and free texts and a seamless experience of editing scripts and voices in one go.


$ npm install wiki2ssml


$ yarn add wiki2ssml




Supported Markups

Expressions Operations
[[volume:SCALE|TEXT]] Speaking volume
[[speed:SCALE|TEXT]] Speaking rate
[[pitch:SCALE|TEXT]] Speaking pitch
[[silence:DURATION,strength:STRENGTH]] Pause with duration and strength
[[emphasis:LEVEL|TEXT]] Emphasis with LEVEL
[[audio:AUDIO_URI]] Audio embedded into speech
[[lang:LANGUAGE|TEXT]] Language indicator
[[paragraph|TEXT]] Paragraph indicator
[[sentence|TEXT]] Sentence indicator
[[type:TYPE|TEXT]] Type it should be said as
[[voice:NAME|TEXT]] Voice name it should be said with
[[pos:POS|TEXT]] Part of speech it should be prounouced as
[[substitute:TEXT1|TEXT2]] Replace TEXT2 with TEXT1 as substitution
[[alphabet:ALPHABET,pronunciation:PRONUNCIATION|TEXT]] Phonetic pronunciation
[[volume:SCALE,speed:SCALE,pitch:SCALE|TEXT]] Speaking volume, rate and pitch
[[type:TYPE,format:FORMAT,detail:DETAIL|TEXT]] Type it should be said as
[[mark:NAME]] Mark referencing a location
[[seeAlso:URI] URI providing additional information about marked-up content]
[[cacheControl:no-cache]] No caching on marked-up content
[[lexicon:URI,type:TEXT]] Location of the lexicon document and its media type
*[[...]][[...]]...[[...]]* <par> time container with one or more markups
#[[...]][[...]]...[[...]]# <seq> time container with one or more markups

Vendor-Specific Markups

Expressions Operations
[[amzWhispered|TEXT]] Whispering
[[amzPhonation:PHONATION|TEXT]] Speaking Softly
[[amzTimbre:SCALE|TEXT]] Controlling Timbre
[[amzDRC|TEXT]] Dynamic Range Compression
[[amzBreathDuration:SCALE,amzBreathVolume:SCALE]] Breathing based on the manual model
[[amzDefaultBreath]] Default breathing based on the manual model
[[amzAutoBreathsVolume:SCALE,amzAutoBreathsFrequency:SCALE,amzAutoBreathsDuration:SCALE|TEXT]] Breathing based on the automated model
[[amzDefaultAutoBreaths]] Default breathing based on the automated model
[[amzSpeakingStyle:STYLE|TEXT]] Speaking style
[[amzEmotion:EMOTION,amzIntensity:SCALE|TEXT]] Speaking emotionally
[[amzMaxDuration:DURATION#124;TEXT]] Maximum Speech duration
[[gglMediaSpeak|TEXT]] Media container for speech
[[gglMediaSpeakEnd:DURATION|TEXT]] Media container for speech with the ending time
[[gglMediaSpeakFadeIn:DURATION,gglMediaSpeakFadeOut:DURATION|TEXT]] Media container for speach with fade
[[gglMediaAudio:URI]] Media container for audio
[[gglMediaAudioFadeIn:DURATION,gglMediaAudioFadeOut:DURATION,gglMediaAudio:URI]] Media container for audio with fade
[[ibmExprType:TYPE|TEXT]] Expressiveness type
[[ibmTransType:TYPE,ibmTransStrength:SCALE|TEXT]] Voice transformation
[[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). 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.

parseToSsml(input, languageCode, options)

  • input <string> (required)
  • languageCode <string> (required: RFC 1766)
  • options <object> (optional)
    • version <string> (default: "1.1")
    • pretty <boolean> (default: false)
    • encoding <string> (default: "UTF-8")


var parser = require("wiki2ssml");
try {
    var input = "[[volume:+2dB,speed:50%|Speak this with the volume increased by 2dB at half the default speech rate.]]";
    var ssml = parser.parseToSsml(input, "en-GB", {pretty: true});
} catch (e) {
    if (instanceof parser.SyntaxError) {
        // The input does not have valid WikiVoice markups
    } else if (instanceof parser.ArgumentError) {
        // Either the input or the language code is missing
    } else {
        // Handle any unspecified exceptions

will output:

<?xml version="1.0" encoding="UTF-8"?>
<speak version="1.1" xmlns="" xmlns:xsi="" xsi:schemaLocation="" xml:lang="en-GB">
  <prosody rate="50%" volume="+2dB">Speak this with the volume increased by 2dB at half the default speech rate.</prosody>


npm i wiki2ssml

DownloadsWeekly Downloads






Unpacked Size

209 kB

Total Files


Last publish


  • avatar