ssml-toolbox

1.0.1 • Public • Published

SSML Tooling

My personnal SSML Toolbox, first attempt.

You're very welcome to contribute!

Installation

As usual:

npm install ssml-toolbox --save

Usage

'use strict';
// First, get and instantiate the builder, and the tag constructing methods if you need some
// Here we took the specific Google builder.
const { GoogleSsmlBuilder, s, media, speak } = require('ssml-toolbox');
const builder = new GoogleSsmlBuilder();
// You can use is basically to have some text
const ssml = builder.say('Hello world!').toString();
// Outputs: "Hello world!"

// Or you can use all the methods
const ssml2 = builder
    .say('This is a new test')
    .addBreakTag('500ms')
    .addP([s('One sentence'), s('Two sentences')])
    .addAudio('http://fake.url', 'This will not play...')
    .addSayAs('2018-03-10', 'date', {format: 'yyyymmdd'})
    .addP('Wow, paragraph!')
    // Google specific tag
    .addPar([media(speak('fake')), media(speak('test'))])
    .toString(true)
;
// Ouputs: 
// <speak>This is a new test<break time="500ms"/> \
// <p><s>One sentence</s><s>Two sentences</s></p> \
// <audio src="http://fake.url">This will not play...</audio> \
// <say-as interpret-as="date" format="yyyymmdd">2018-03-10</say-as> \
// <p>Wow, paragraph!</p></speak>

APIS:

Readme

Keywords

none

Package Sidebar

Install

npm i ssml-toolbox

Weekly Downloads

26

Version

1.0.1

License

MIT

Unpacked Size

19.4 kB

Total Files

14

Last publish

Collaborators

  • tiriel