{"_id":"ssml","_rev":"10-289b32f3efffaca23b774ebff585926e","name":"ssml","description":"a SSML document builder for node.js","dist-tags":{"latest":"0.0.4"},"versions":{"0.0.1":{"name":"ssml","version":"0.0.1","description":"a SSML document builder for node.js","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["ssml","voice","tts","speech"],"author":{"name":"TheFuzzy"},"license":"MIT","dependencies":{"xmlbuilder":"~2.1.0","underscore":"~1.5.2"},"_id":"ssml@0.0.1","dist":{"shasum":"b6128123a3bae7a609081a6852ed2ecdef016623","tarball":"https://registry.npmjs.org/ssml/-/ssml-0.0.1.tgz","integrity":"sha512-gls49Mly/P4jDeqbfDseRWrKzRKGh663E1M/xBd3YRA3jzYzbRt2upbn4rDvPpmk8E2UdNFzmo30Bljv4f3O6A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8/0mEXkUs+/183FSHTSL8XpJXoL8HtFaqiOl5SagmZgIgGyW7a9BhfCotLL0JVorjMxIZGQLyz3FYTNjO/H5A0mI="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"thefuzzy","email":"Infestor51@gmail.com"},"maintainers":[{"name":"thefuzzy","email":"Infestor51@gmail.com"}]},"0.0.2":{"name":"ssml","version":"0.0.2","description":"a SSML document builder for node.js","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["ssml","voice","tts","speech"],"author":{"name":"TheFuzzy"},"license":"MIT","dependencies":{"xmlbuilder":"~2.1.0","underscore":"~1.5.2"},"repository":{"type":"git","url":"git://github.com/TheFuzzy/node-ssml.git"},"bugs":{"url":"https://github.com/TheFuzzy/node-ssml/issues"},"homepage":"https://github.com/TheFuzzy/node-ssml","_id":"ssml@0.0.2","dist":{"shasum":"79c67b6ec65e3a59d6709fcb29b170957253680d","tarball":"https://registry.npmjs.org/ssml/-/ssml-0.0.2.tgz","integrity":"sha512-EGfc/mgK5lNQLTZvCAkHCpilovn8RbEj2jWI85huiuSxMbu5uueU0dg4wxI3qzTaq7LMkqp4PH0DDefHz3FdWw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIALvYh8TJE7JFeIo6JlGFkui0WTyQACGyUA1sMD+8nw1AiEAqvk6PzL9A8DQP4BuvpO/VYDhTQsjEgMPdkhPf/JMlmI="}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"thefuzzy","email":"Infestor51@gmail.com"},"maintainers":[{"name":"thefuzzy","email":"Infestor51@gmail.com"}]},"0.0.3":{"name":"ssml","version":"0.0.3","description":"a SSML document builder for node.js","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["ssml","voice","tts","speech"],"author":{"name":"TheFuzzy"},"license":"MIT","dependencies":{"xmlbuilder":"~2.1.0","underscore":"~1.5.2"},"repository":{"type":"git","url":"git://github.com/TheFuzzy/node-ssml.git"},"gitHead":"ba2b3afda3afd5e3863d669a25d41fe352e0e136","bugs":{"url":"https://github.com/TheFuzzy/node-ssml/issues"},"homepage":"https://github.com/TheFuzzy/node-ssml","_id":"ssml@0.0.3","_shasum":"7fc193295b69567576a310f894b996c29f5ccc8b","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"thefuzzy","email":"Infestor51@gmail.com"},"maintainers":[{"name":"thefuzzy","email":"Infestor51@gmail.com"}],"dist":{"shasum":"7fc193295b69567576a310f894b996c29f5ccc8b","tarball":"https://registry.npmjs.org/ssml/-/ssml-0.0.3.tgz","integrity":"sha512-/9QWvcsXxBLQ441JW4+3IT+gFDM7jWKNHwF+OLlroOJMKbNZOLHS8cyH37+NXjWWfVltGuXJXs7b81xYTnFKRA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHC2fSTtqO/IvZg2w7B7689WqHETieHIOj90jvtSFN/uAiADFVj3VNQnRLqP98LPk94+mS6EcLWh5zu/sXSrZKddIA=="}]}},"0.0.4":{"name":"ssml","version":"0.0.4","description":"a SSML document builder for node.js","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["ssml","voice","tts","speech"],"author":{"name":"TheFuzzy"},"license":"MIT","dependencies":{"xmlbuilder":"~2.1.0","underscore":"~1.5.2"},"repository":{"type":"git","url":"git://github.com/TheFuzzy/node-ssml.git"},"gitHead":"e73b4f824ed1ec7e007575127882ff88e704e6c0","bugs":{"url":"https://github.com/TheFuzzy/node-ssml/issues"},"homepage":"https://github.com/TheFuzzy/node-ssml#readme","_id":"ssml@0.0.4","_shasum":"e4fe4a526af0fc230e154a21bbe6dfc413b5095c","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.1","_npmUser":{"name":"thefuzzy","email":"Infestor51@gmail.com"},"maintainers":[{"name":"thefuzzy","email":"Infestor51@gmail.com"}],"dist":{"shasum":"e4fe4a526af0fc230e154a21bbe6dfc413b5095c","tarball":"https://registry.npmjs.org/ssml/-/ssml-0.0.4.tgz","integrity":"sha512-u2KV/0WQ0Xibn7NpjIkn6W6nZwFu0JeSZ7DbRsSHZCs4KOF3sAbZUsJKirIhhMZOO6XydGCCD/fMT/WWGOeX1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCEHbFn+bQMrYJEH42jtXxK0q9XU6gAsxnkgFPPhoHdUAIhAJ+bAq3Grjlh3/kUUzLtuYDzrVdrq6wJ8xKsYOWoCw+3"}]}}},"readme":"# node-ssml\r\n[![NPM](https://nodei.co/npm/ssml.png)](https://nodei.co/npm/ssml/)\r\n\r\nA Node.js library for producing SSML (Speech Synthesis Markup Language) according to specifications.\r\n\r\nCurrently, this library only implements [SSML 1.0](http://www.w3.org/TR/speech-synthesis/).\r\nThe documentation also assumes that the reader has at least *skimmed* through the specification.\r\n\r\nAs of v0.0.2, only the following elements of SSML are supported:\r\n\r\n* say-as\r\n* prosody\r\n* audio\r\n* break\r\n* sub\r\n\r\n## Basic Usage\r\n\r\nThis library makes use of method chaining for convenience.\r\n\r\n```javascript\r\nvar ssml = require('ssml');\r\nvar ssmlDoc = new ssml();\r\n\r\nssmlDoc.say('This is a great voice application!')\r\n    .break(500)\r\n    .prosody({ rate: '0.8' })\r\n    .say('Awkward pause')\r\n    .toString({ pretty: true });\r\n```\r\n\r\nOutput:\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\tThis is a great voice application!\r\n\t<break time=\"500ms\"/>\r\n\t<prosody rate=\"0.8\">Awkward pause</prosody>\r\n</speak>\r\n```\r\n\r\nXML output examples in the later section assume `pretty` is set to true for the `toString()` function (described later), for easier reading.\r\n\r\n## Initialization\r\n\r\nSimply initialize a document instance as follows:\r\n\r\n```javascript\r\nvar ssml = require('ssml');\r\n...\r\nvar ssmlDoc = new ssml()\r\n```\r\n\r\nThe document is initialized with the language set to `en-US` by default. To use a different language, specify it in the `language` parameter:\r\n\r\n```javascript\r\nvar ssmlDoc = new ssml({ language: 'fr-FR' });\r\n...\r\nssmlDoc.toString()\r\n```\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"fr-FR\">\r\n...\r\n```\r\n\r\n## Elements\r\n\r\nNote that all functions, including elements, are object-based, and not static.\r\n\r\n### say(text[, options]) / say(options)\r\n\r\nProduces basic text output. Usage is as follows:\r\n\r\n```javascript\r\nssmlDoc.say('I am talking to you.');\r\n```\r\n\r\nThe text string can also be described by the `text` parameter.\r\n\r\n`interpretAs` can also be specified as an additional parameter, but will encapsulate the text-output into a `say-as` element. More parameters can be specified for the `say-as` element, only *if* `interpretAs` is used:\r\n\r\n* `format`\r\n* `detail`\r\n\r\nTheir respective purposes can be found in [the specification](http://www.w3.org/TR/ssml-sayas/).\r\n\r\nExample:\r\n\r\n```javascript\r\nssmlDoc.say('The time now is ')\r\n    .say({\r\n        text: '01:59:59',\r\n        interpretAs: 'telephone',\r\n        format: 'hms24'\r\n    })\r\n    .toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\tThe time now is\r\n\t<say-as interpret-as=\"time\" format=\"hms24\">01:59:59</say-as>\r\n</speak>\r\n```\r\n\r\n### break(time[, options]) / break(options)\r\n\r\nRepresents a pause in the speech. Accepts one of the following parameters:\r\n\r\n* `time` - Can be a string or number. If passed as a number, it will be converted to a string automatically, and appended with `ms`. Will override `strength` if defined.\r\n* `strength` - A string value that describes the length of time in a human-readable form i.e. `weak`, `medium`, `strong`.\r\n\r\n`time` may also be defined as the first parameter of the `break` function for convenience, i.e.:\r\n\r\n```javascript\r\n.break(500) // 500ms\r\n```\r\n\r\nAdditional information on these parameters can be found in [the specification](http://www.w3.org/TR/speech-synthesis/#edef_break).\r\n\r\nExample:\r\n\r\n```javascript\r\nssmlDoc.say('It\\'s time for an awkward pause!')\r\n    .break({\r\n        time: '5s',\r\n        strength: 'strong'\r\n    })\r\n    .toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\tIt's time for an awkward pause!\r\n\t<break time=\"5s\"/>\r\n</speak>\r\n```\r\n\r\n### prosody(options)\r\n\r\nRepresents a speech adjustment. Any element contained in a `prosody` element will receive the adjustments described by its parameters.\r\n\r\n`prosody` also switches the internal context of the SSML document, so that further element calls will render elements within the `prosody` element. Use `up()`(covered later) to reset the context to the previous level.\r\n\r\nAccepts any of the following parameters, alone or in combination:\r\n\r\n* `pitch` - A string or number that controls the pitch of the spoken text. If a number is supplied, `Hz` will be appended to the output.\r\n* `rate` - A string or number that controls the speed of the spoken text.\r\n* `range` - A string or number that controls the pitch range of the spoken text. If a number is supplied, `Hz` will be appended to the output.\r\n* `volume` - A string or number that controls the volume of the spoken text.\r\n* `contour` - a string containing a set of values to finely tune the pitch of the spoken text.\r\n\r\nAdditional information on these parameters can be found in [the specification](http://www.w3.org/TR/speech-synthesis/#edef_prosody).\r\n\r\nExample:\r\n\r\n```javascript\r\n// Produce a sarcastic apology.\r\nssmlDoc.say('I\\'m ')\r\n    .prosody({\r\n        rate: '0.6',\r\n        pitch: '-50%'\r\n    })\r\n    .say('sorry')\r\n    .toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\tI'm\r\n\t<prosody pitch=\"-50% rate=\"0.6\">sorry</prosody>\r\n</speak>\r\n```\r\n\r\n### audio(src[, options]) / audio(options)\r\n\r\nRepresents an audio resource. Accepts the following parameters:\r\n\r\n* `src` or `source` - The URI pointing to a valid audio resource. Required.\r\n* `alt` - A string that is rendered by the speech processor if the audio resource cannot be found. Optional.\r\n\r\n`src` may also be defined as the first parameter of the `audio` function for convenience, i.e.:\r\n\r\n```javascript\r\n.audio('http://yourdomain.com/audio.mp3')\r\n```\r\n\r\nAdditional information on these parameters can be found in [the specification](http://www.w3.org/TR/speech-synthesis/#edef_audio).\r\n\r\nExample:\r\n\r\n```javascript\r\n// Rickroll the guy.\r\nssmlDoc.audio({\r\n        src: 'http://music.com/Never Gonna Give You Up.mp3',\r\n        alt: 'For some reason that didn\\'t work. Oh well.'\r\n    })\r\n    .toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\t<audio src=\"http://music.com/Never Gonna Give You Up.mp3\">For some reason that didn't work. Oh well.</audio>\r\n</speak>\r\n```\r\n\r\n## Helper functions\r\n\r\n### up()\r\n\r\nThis function sets the internal context to the previous level in XML. If there is no previous level, the function does nothing.\r\n\r\nNote that as of v0.0.2, this is a mutable operation affecting the SSML document object, and cannot be reversed.\r\n\r\nExample:\r\n\r\n```javascript\r\n// Mock the user\r\nssmlDoc.say('Now, now.')\r\n    .prosody({ rate: '0.8' })\r\n    .say('There\\'s no need to be upset.')\r\n    .up()\r\n    .say('We\\'ll be just fine!')\r\n    .toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\tNow, now.\r\n\t<prosody rate=\"0.8\">There's no need to be upset.</prosody>\r\n\tWe'll be just fine!\r\n</speak>\r\n```\r\n\r\n### clear()\r\n\r\nThis function clears all elements from the SSML document object.\r\n\r\n### replace(wordToReplace, replaceWith) / replace(keyValues)\r\n\r\nThis function replaces all instances of the word(s) with another word/set of words. These can be passed in as the first and second parameters for a single key-value pair, or as an object containing key-value pairs. The words will then be added to an internal dictionary and processed only when `toString()` is called.\r\n\r\nNote that the `replace` function is case-sensitive, and does not modify the original text.\r\n\r\nThe replaced words will still be rendered, but wrapped in a `sub` element. Additional information about this element can be found in [the specification](http://www.w3.org/TR/speech-synthesis/#edef_sub).\r\n\r\nExample:\r\n\r\n```javascript\r\nssmlDoc.replace('balls of fire', 'suns above')\r\n    .say('Great balls of fire! The time has arrived, and thus have I!')\r\n    .addReplace({\r\n        'arrived' : 'come',\r\n        'thus' : 'so'\r\n    })\r\n    .say('Thus, we\\'ll commence the operation!')\r\n    .toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">\r\n\tGreat <sub alias=\"suns above\">balls of fire</sub>! The time has <sub alias=\"come\">arrived</sub>, and <sub alias=\"so\">thus</sub> have I!\r\n\tAnd <sub alias=\"so\">thus</sub>, we'll commence the operation!\r\n</speak>\r\n```\r\n\r\n### addReplace(wordToReplace, replaceWith) / replace(keyValues)\r\n\r\nAlias for `replace`.\r\n\r\n### removeReplace(key)\r\n\r\nThis function removes the key from the internal dictionary. If an array of strings is provided, all keys matching the elements in the array will be removed.\r\n\r\n### clearReplace()\r\n\r\nClears all keys from the internal dictionary.\r\n\r\n## Output\r\n\r\n### toString(options)\r\n\r\nRenders the SSML document as a string, which can be passed to the speech processor through a suitable medium later.\r\n\r\nAccepts the following parameters:\r\n\r\n* `minimal` - setting this to true renders a `speak` XML root element with no properties (including required properties such as `xml:lang`) or XML header. Takes priority over `full`.\r\n* `full` - setting this to true renders a `speak` XML root element with required *and* optional properties.\r\n\r\nAdditionally, as the `xmlbuilder` library is being used, the options object may also contain any parameters suitable for the `toString()` method, such as `pretty` or `indent`. Refer to the `xmlbuilder` [documentation](https://github.com/oozcitak/xmlbuilder-js/wiki) for details.\r\n\r\nExamples:\r\n\r\n```javascript\r\nssmlDoc.toString();\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\">Hello there!</speak>\r\n```\r\n\r\n```javascript\r\nssmlDoc.toString({ full:true, minimal: true });\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<speak>Hello there!</speak>\r\n```\r\n\r\n```javascript\r\nssmlDoc.toString({ full:true });\r\n```\r\n\r\nOutput:\r\n\r\n```xml\r\n<?xml version=\"1.0\">\r\n<speak xmlns=\"http://www.w3.org/2001/10/synthesis\" version=\"1.0\" xml:lang=\"en-US\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.w3.org/TR/speech-synthesis/synthesis.xsd\">Hello there!</speak>\r\n```\r\n","maintainers":[{"name":"thefuzzy","email":"Infestor51@gmail.com"}],"time":{"modified":"2022-06-26T23:34:41.188Z","created":"2014-01-03T11:33:03.100Z","0.0.1":"2014-01-03T11:33:05.108Z","0.0.2":"2014-01-15T04:53:39.893Z","0.0.3":"2014-11-12T15:41:05.077Z","0.0.4":"2016-01-07T14:45:25.154Z"},"author":{"name":"TheFuzzy"},"repository":{"type":"git","url":"git://github.com/TheFuzzy/node-ssml.git"},"homepage":"https://github.com/TheFuzzy/node-ssml#readme","keywords":["ssml","voice","tts","speech"],"bugs":{"url":"https://github.com/TheFuzzy/node-ssml/issues"},"license":"MIT","readmeFilename":"README.md"}