<html class=no-js lang=en xmlns:functx=http://www.functx.com><meta content="text/html; charset=utf-8"http-equiv=Content-Type><meta charset=utf-8><meta content=IE=edge http-equiv=X-UA-Compatible><meta content="www.XML.com,Textuality Services,Peter Mikhalenko,Vocabularies, Specifications, Multimedia,Speech Synthesis Markup Language: An Introduction"name=keywords><meta content="October 20, 2004"name=date><meta content="Speech Synthesis Markup Language: An Introduction"name=pagename><meta content=www.XML.com name=site><meta content="Peter Mikhalenko"name=author><title>
   Speech Synthesis Markup Language: An Introduction
  </title><meta name=description><meta content=width=device-width,initial-scale=1 name=viewport><link href=/static/favicon.ico rel=icon type=image/x-icon><link href=/static/CACHE/css/73bd8c42a922.css rel=stylesheet><link href=https://fonts.googleapis.com/css?family=Lato|Roboto rel=stylesheet><link href=/static/css/print.css media=print rel=stylesheet><script>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
    m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
    })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
                            
    ga('create', 'UA-79723435-1', 'auto');
    ga('send', 'pageview');</script><script async src=https://www.googletagservices.com/tag/js/gpt.js></script><script>var googletag = googletag || {};
            googletag.cmd = googletag.cmd || [];</script><script>googletag.cmd.push(function() {
            googletag.defineSlot('/21754636678/xml.com-1', [[160, 600], [120, 240], [300, 250]], 'div-gpt-ad-1550450394815-0').addService(googletag.pubads());
            googletag.defineSlot('/21754636678/xml.com-2', [[300, 250]], 'div-gpt-ad-1550513522284-0').addService(googletag.pubads());
            googletag.pubads().enableSingleRequest();
            googletag.pubads().disableInitialLoad();
            googletag.enableServices();
            });</script><script>//load the apstag.js library
            !function(a9,a,p,s,t,A,g){if(a[a9])return;function q(c,r){a[a9]._Q.push([c,r])}a[a9]={init:function(){q("i",arguments)},fetchBids:function(){q("f",arguments)},setDisplayBids:function(){},targetingKeys:function(){return[]},_Q:[]};A=p.createElement(s);A.async=!0;A.src=t;g=p.getElementsByTagName(s)[0];g.parentNode.insertBefore(A,g)}("apstag",window,document,"script","//c.amazon-adsystem.com/aax2/apstag.js");
            
            //initialize the apstag.js library on the page to allow bidding
            apstag.init({
            pubID: '32676f4f-8458-484f-b742-dcd7ad80a504', //enter your pub ID here as shown above, it must within quotes
            adServer: 'googletag'
            });
            apstag.fetchBids({
            slots: [{
            slotID: 'div-gpt-ad-1550450394815-0', //example: 'div-gpt-ad-1475102693815-0'
            slotName: '21754636678/xml.com-1', //example: '12345/box-1'
            sizes: [[160,600], [300,250], [120,400]] //example: [[300,250], [300,600]]
            },
            {
            slotID: 'div-gpt-ad-1550513522284-0', //example: 'div-gpt-ad-1475185990716-0'
            slotName: '21754636678/xml.com-2', //example: '12345/leaderboard-1'
            sizes: [[300,250]] //example: [[728,90]]
            }],
            timeout: 2e3
            }, function(bids) {
            // set apstag targeting on googletag, then trigger the first DFP request in googletag's disableInitialLoad integration
            googletag.cmd.push(function(){
            apstag.setDisplayBids();
            googletag.pubads().refresh();
            });
            });</script><body class=homepage><div class="title-bar hide-for-print"data-hide-for=large data-responsive-toggle=menu><button class=menu-icon data-toggle=data-toggle type=button value=Menu></button><div class=title-bar-title>Menu</div></div><div class=row><div class="top-bar hide-for-print"id=menu><div class=top-bar-left><a href=/> <img alt="XML.com logo"src=/static/img/small-logo.png> </a></div><div class=top-bar-right><ul class="menu vertical medium-horizontal"data-responsive-menu="drilldown medium-dropdown"role=menubar><li><a href=/> Home </a><li><a href=/articles/> Articles </a><li><a href=/authors/> Authors </a><li><a href=/news/> News </a><li><a href=/job-board/> Job Board </a><li class=has-submenu><a href=/about/> About </a> <ul class="submenu menu vertical"><li><a href=/about/contribute/> Contribute </a><li><a href=/about/style-guide/> Style guide </a><li><a href=/about/copyright/> Copyright </a><li><a href=/about/contact/> Contact </a><li><a href=/about/privacy/> Privacy Policy </a></ul><li style="background: transparent;"class=has-form><form action=https://google.com/cse id=cse-search-box><input name=cx type=hidden value=partner-pub-9264479583913780:3063344556><input name=ie type=hidden value=UTF-8><input name=q placeholder=Search title=Search></form></ul></div></div></div><div class=row><div class="medium-9 columns"><div id=content><div class="medium-12 columns"role=content><article class=article><h3>Speech Synthesis Markup Language: An Introduction</h3><p>October 20, 2004<p><a href=/pub/au/226> Peter Mikhalenko </a><p><a href=http://www.w3.org/TR/speech-synthesis/> Speech Synthesis Markup Language Specification </a> (SSML 1.0), introduced in September 2004, is one of the standards enabling access to the Web using spoken interaction. It's designed to provide a rich, XML-based markup language for assisting the generation of synthetic speech in web and other applications. The essential role of SSML is to provide authors of synthesizable content a standard way to control aspects of speech such as pronunciation, volume, pitch, rate, etc., across different synthesis-capable platforms.<h3>Background</h3><p>The SSML specification is based upon <a href=http://www.w3.org/TR/jsml/> JSML </a> and <a href=http://www.w3.org/TR/jsgf/> JSGF </a> specifications, which are owned by Sun. Originally JSML (JSpeech Markup Language) was developed as a very simple XML format used by applications to annotate text input to speech synthesizers. JSML had characteristics very similar to SSML: it defined elements that described the structure of a document, provided pronunciations of words and phrases, indicated phrasing, emphasis, pitch and speaking rate, and controlled other important speech characteristics. The letter "J" in the markup language name has come from the <a href=http://java.sun.com/products/java-media/speech/> Java(TM) Speech API </a> , introduced by Sun in collaboration with leading speech technology companies, for incorporating speech technology into user interfaces of applets and applications based on Java technology. The design of JSML elements and its semantics are quite simple. Here is the typical self-explaining example:<pre>&LTjsml> 

	&LTvoice gender="female" age="20">

		&LTdiv type="paragraph">

		You have an incoming message from 

		&LTemphasis>Peter Mikhalenko&LT/emphasis> in your mailbox.

		Mail arrived at &LTsayas class="time">7am&LT/sayas> today.

		&LT/div>

	&LT/voice>



	&LTvoice gender="male" age="30">



		&LTdiv type="paragraph">

		Hi, Steve!

		&LTbreak/>

		Hope you're OK.

		&LT/div>



		&LTdiv>

		Sincerely yours, Peter.

		&LT/div>

	&LT/voice>

&LT/jsml></pre><p>The JSpeech Grammar Format (JSGF) is a representation of grammars for use in speech recognition. It defines a platform- and vendor-independent way to describe one type of grammar, a rule grammar (also known as a command and control grammar or regular grammar). Grammars are used by speech recognizers to determine what the recognizer should listen for and so describe the utterances a user may say. JSGF is not an XML format and is out of scope of this article.<h3>SSML's Place in the Global Scope</h3><p>Voice browsers are a very important part of <a href=http://www.xml.com/pub/a/2004/01/21/multimodal.html> Multimodal Interaction </a> and <a href=http://www.xml.com/pub/a/2004/09/22/di.html> Device Independence </a> , making web applications accessible with multiple modes of interaction. A <i> voice browser </i> is a device that interprets a markup language and is capable of generating voice output or interpreting voice input, and possibly other input/output modalities. There is a whole set of markup specifications for voice browsers developed at W3C, and SSML is a part of it. <i> Speech synthesis </i> is a process of automatic generation of speech output from data input which may include plain text, marked up text or binary objects. It must be practical to generate speech synthesis output from a wide range of existing document representations. The common requirement to speech synthesis markup is that speech output from HTML, HTML with CSS, XHTML, XML with XSL, and DOM must be possible. The intended use of SSML is to improve the quality of synthesized content.<h3>Language Use</h3><p>The key concepts of SSML are<ul><li>interoperability, or interacting with other markup languages (VoiceXML, SMIL etc.);<li>consistency, or providing predictable control of voice output across platforms and across speech synthesis implementations; and<li>internationalization, or enabling speech output in a large number of languages within or across documents.</ul><p>The system of automatic generation of speech output from text or annotated text input that supports SSML must render a document as spoken output using the information contained in the markup to render the document as intended by the author. There are several steps in a speech synthesis process.<ol><li><b> XML parse </b> . The incoming text document is parsed and the document tree with content are extracted.<li><b> Structure analysis </b> . The structure of a document influences the way in which a document should be read. For example, there are common speaking patterns associated with paragraphs and sentences.<li><b> Text normalization </b> . All written languages have special constructs that require a conversion of the written form (orthographic form) into the spoken form. Text normalization is an automated process of the synthesis processor that performs this conversion. For example, for English, when "$1000" appears in a document it may be spoken as "one thousand dollars." The orthographic form "1/2" may be potentially spoken as "one half," "January second," "February first," "one of two," and so on. By the end of this step the text to be spoken has been converted completely into tokens. The exact details of what constitutes a token are language-specific. A special <code>
          &LTsay-as/>
         </code> element can be used in the input document to explicitly indicate the presence and type of these constructs and to resolve ambiguities.<li><b> Text-to-phoneme conversion </b> . After the processor has determined the set of words to be spoken, it must derive pronunciations for each word. Word pronunciations may be conveniently described as sequences of phonemes, which are units of sound in a language that serve to distinguish one word from another. Each language has a specific phoneme set. This step is quite hard and complex according to several reasons. First of all, there are differences between written and spoken forms of a language, and these differences can lead to indeterminacy or ambiguity in the pronunciation of written words. For example, in English, "read" may be spoken as "reed" (I will read the book) or "red" (I have read the book). Both human speakers and synthesis processors can pronounce these words correctly in context but may have difficulty without context. The <code>
          &LTphoneme/>
         </code> element of SSML allows a phonemic sequence to be provided for any word or word sequence.<li><b> Prosody analysis </b> . <i> Prosody </i> is the set of features of speech output that includes the pitch (also called intonation or melody), the timing (or rhythm), the pausing, the speaking rate, the emphasis on words and many other features. Producing humanlike prosody is important for making speech sound natural and for correctly conveying the meaning of spoken language. In SMIL there are special elements <code>
          &LTbreak/>
         </code> , <code>
          &LTemphasis/>
         </code> and <code>
          &LTprosody/>
         </code> for prosody purposes, which I will describe below.<li><b> Waveform production </b> . This is a final step in producing audio waveform output from the phonemes and prosodic information. There are many approaches to this processing step so there may be considerable processor-specific variation. The <code>
          &LTvoice/>
         </code> element in SSML allows the document creator to request a particular voice or specific voice qualities (e.g. a young male voice).</ol><p>SSML provides a standard way to specify gross properties of synthetic speech production such as pronunciation, volume, pitch, rate, etc. Exact specification of synthetic speech output behavior across disparate processors, however, is beyond the scope of the SSML specification. It should be noticed that markup values are merely indications rather than absolutes. For example, it is possible for an author to explicitly indicate the duration of a text segment and also indicate an explicit duration for a subset of that text segment. If the two durations result in a text segment that the synthesis processor cannot reasonably render, the processor is permitted to modify the durations as needed to render the text segment.<h3>The Structure and Examples</h3><p>The root element of an SSML document is <code>
         &LTspeak/>
        </code> . The <code>
         &LTmeta/>
        </code> , <code>
         &LTmetadata/>
        </code> and <code>
         &LTlexicon/>
        </code> elements must occur before all other elements and text contained within the root <code>
         &LTspeak/>
        </code> element. There are no other ordering constraints on the elements in the specification. The root element must have a mandatory <code>
         xml:lang
        </code> attribute specifying the language of the root document. <code>
         xml:lang
        </code> attribute can be used in <code>
         &LTvoice/>
        </code> , <code>
         speak/>
        </code> , <code>
         &LTp/>
        </code> and <code>
         &LTs/>
        </code> elements. Also root element must have <code>
         version
        </code> attribute and must have the value "1.0". The root element can only contain text to be rendered and the following elements: <code>
         &LTaudio/>
        </code> , <code>
         &LTbreak/>
        </code> , <code>
         &LTemphasis/>
        </code> , <code>
         &LTlexicon/>
        </code> , <code>
         &LTmark/>
        </code> , <code>
         &LTmeta/>
        </code> , <code>
         &LTmetadata/>
        </code> , <code>
         &LTp/>
        </code> , <code>
         &LTphoneme/>
        </code> , <code>
         &LTprosody/>
        </code> , <code>
         &LTsay-as/>
        </code> , <code>
         &LTsub/>
        </code> , <code>
         &LTs/>
        </code> , <code>
         &LTvoice/>
        </code> . This is how <code>
         xml:lang
        </code> can be used:<pre>&LT?xml version="1.0"?>

&LTspeak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

         xml:lang="en-US">

  &LTp>I don't speak French.&LT/p>

  &LTp xml:lang="fr">Bonjour monsieur!&LT/p>

&LT/speak></pre><p>An SSML document may reference one or more external pronunciation lexicon documents. A lexicon document is identified by a URI with an optional media type. No standard lexicon media type has yet been defined as the default for SSML specification. A lexicon document contains pronunciation information for tokens that can appear in a text to be spoken. The pronunciation information contained within a lexicon is used for tokens appearing within the referencing document. Lexicons can be included thusly:<pre>&LTspeak version="1.0"

       xmlns="http://www.w3.org/2001/10/synthesis"

       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

       xsi:schemaLocation="http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

       xml:lang="en-US">



  &LTlexicon uri="http://www.xml.com/lexicon.file"/>

  &LTlexicon uri="http://www.xml.com/slang-words.file"

           type="media-type"/>

  ...

&LT/speak></pre><p>You can include metadata for the document using a metadata schema. The recommended metadata format is the XML serialization of <a href=http://www.w3.org/TR/rdf-syntax-grammar/> RDF </a> .<p>For logical and physical division purposes <code>
         &LTp/>
        </code> and <code>
         &LTs/>
        </code> elements exist. The former represents a paragraph, the latter a sentence. This is example of their usage:<pre>
&LTspeak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

         xml:lang="en-US">

  &LTp>

    &LTs>This is the first sentence of the paragraph.&LT/s>

    &LTs>Here's another sentence.&LT/s>

  &LT/p>

&LT/speak>

</pre><p>The <code>
         &LTsay-as/>
        </code> element allows the author to indicate information on the type of text construct contained within the element and to help specify the level of detail for rendering the contained text. Defining a comprehensive set of text format types is difficult because of the variety of languages that have to be considered and because of the innate flexibility of written languages. SSML only specifies the say-as element, its attributes, and their purpose. It does not enumerate the possible values for the attributes. The <code>
         &LTsay-as/>
        </code> element has three attributes: <code>
         interpret-as
        </code> , <code>
         format
        </code> , and <code>
         detail
        </code> .<p>The <code>
         interpret-as
        </code> attribute is always required; the other two attributes are optional. The legal values for the format attribute depend on the value of the <code>
         interpret-as
        </code> attribute. The <code>
         interpret-as
        </code> attribute indicates the content type of the contained text construct. Specifying the content type helps the synthesis processor to distinguish and interpret text constructs that may be rendered in different ways depending on what type of information is intended. In addition, the optional format attribute can give further hints on the precise formatting of the contained text for content types that may have ambiguous formats. The <code>
         detail
        </code> attribute is an optional attribute that indicates the level of detail to be read aloud or rendered. Every value of the detail attribute must render all of the informational content in the contained text; however, specific values for the detail attribute can be used to render content that is not usually informational in running text but may be important to render for specific purposes.<p>The <code>
         &LTphoneme/>
        </code> element provides a phonemic/phonetic pronunciation for the contained text. The phoneme element may be empty. However, it is recommended that the element contain human-readable text that can be used for non-spoken rendering of the document. The <code>
         ph
        </code> attribute is a required attribute that specifies the phoneme/phone string. This element is designed strictly for phonemic and phonetic notations and is intended to be used to provide pronunciations for words or very short phrases. The phonemic/phonetic string does not undergo text normalization and is not treated as a token for lookup in the lexicon. Briefly, phonemic strings consist of phonemes, language-dependent speech units that characterize linguistically significant differences in the language; loosely, phonemes represent all the sounds needed to distinguish one word from another in a given language. The <code>
         alphabet
        </code> attribute is an optional attribute that specifies the phonemic/phonetic alphabet. An alphabet in this context refers to a collection of symbols to represent the sounds of one or more human languages. The only valid values for this attribute are <code>
         "ipa"
        </code> and vendor-defined strings of the form <code>
         "x-organization"
        </code> or <code>
         "x-organization-alphabet"
        </code> . Here is an example of element usage:<pre>&LTspeak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

         xml:lang="en-US">

  &LTphoneme alphabet="ipa" ph="t&amp#x259;mei&amp#x325;&amp#x27E;ou&amp#x325;"> tomato &LT/phoneme>

&LT/speak></pre><p>The <code>
         &LTsub/>
        </code> element is employed to indicate that the text in the alias attribute value replaces the contained text for pronunciation. This allows a document to contain both a spoken and written form. The required alias attribute specifies the string to be spoken instead of the enclosed string. The processor should apply text normalization to the alias value. An example of such substitution might look something like the following:<pre>&LTspeak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

         xml:lang="en-US">

  &LTsub alias="World Wide Web Consortium">W3C&LT/sub>

  &LT!-- World Wide Web Consortium -->

&LT/speak></pre><p>The <code>
         &LTvoice/>
        </code> element is a production element that requests a change in speaking voice. The <code>
         &LTemphasis/>
        </code> element requests that the contained text be spoken with emphasis (also referred to as prominence or stress). The <code>
         &LTbreak/>
        </code> element is an empty element that controls the pausing or other prosodic boundaries between words. The use of the break element between any pair of words is optional. If the element is not present between words, the synthesis processor is expected to automatically determine a break based on the linguistic context. The <code>
         &LTprosody/>
        </code> element permits control of the pitch, speaking rate and volume of the speech output. It has quite complicated attributes, so it's better to read the original specification for further investigating. Here's a typical SSML document:<pre>&LTspeak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://www.w3.org/TR/speech-synthesis/synthesis.xsd"

         xml:lang="en-US">

	&LTvoice gender="female" age="20">

		&LTp>

		You have an incoming message from 

		&LTemphasis>Peter Mikhalenko&LT/emphasis> in your mailbox.

		Mail arrived at &LTsayas class="time">7am&LT/sayas> today.

		&LT/p>

	&LT/voice>



	&LTvoice gender="male" age="30">

		&LTp>

		Hi, Steve!

		&LTbreak/>

		Hope you're OK.

		&LT/p>



		&LTp>

		Sincerely yours, Peter.

		&LT/p>

	&LT/voice>

&LT/speak></pre><h3>Implementations</h3><p>There are several implementations of SSML available, some of them are open source, but others are proprietary, industry implementations. For an open source example, see <a href=http://freetts.sourceforge.net/docs/index.php> FreeTTS </a> . Speech technologies and telecommunications industry leaders include France Telecom, Loquendo S.p.A., ScanSoft, Voxpilot. All of them have provided implementation reports to W3C; for more information see W3C's <a href=http://www.w3.org/Voice/2004/ssml-ir/> SSML 1.0 Implementation Report </a> .</article></div></div></div><aside class="medium-3 columns hide-for-print text-right"id=sidebar><div class=text-center><div id=div-gpt-ad-1550450394815-0><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1550450394815-0'); });</script></div></div><div class=text-center><div style="height:250px; width:300px;"id=div-gpt-ad-1550513522284-0><script>googletag.cmd.push(function() { googletag.display('div-gpt-ad-1550513522284-0'); });</script></div></div></aside></div><div class="row column"><hr class=dotted></div><footer class="row column"><p>Content licensed from and Â© 1998 - 2008 O'Reilly Media, Inc.</footer><script src=/static/CACHE/js/782ec6c34367.js></script>