speak Element (Microsoft.Speech)

Microsoft Speech Platform SDK 11

Collapse image Expand Image Copy image CopyHover image

The required root element of a Speech Synthesis Markup Language (SSML) document.

Syntax

XML  Copy imageCopy Code
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis" xml:lang="string"> </speak>

Attributes

Attribute

Description

version

Required. Indicates the version of the World Wide Web Consortium Speech Synthesis Markup Language (SSML) Version 1.0 specification used to interpret the document markup. The current version is 1.0.

xml:lang

Required. Specifies the language of the root document. The value may contain only a lower-case, two-letter language code, (such as en for English or it for Italian) or may optionally include an upper-case, country/region or other variation in addition to the language code. Examples with a county/region code include es-US for Spanish as spoken in the US, or fr-CA for French as spoken in Canada. See the Remarks section for additional information.

xmlns

Required. Specifies the URI to the document that defines the markup vocabulary (the element types and attribute names) of the SSML document.

The current URI is http://www.w3.org/2001/10/synthesis.

Remarks

The Microsoft Speech Platform SDK 11 accepts all valid language-country codes as values for the xml:lang attribute. For a given language code specified in the xml:lang attribute, a speech synthesis engine that supports that language code must be installed to correctly pronounce words in the specified language.

If the xml:lang attribute specifies only a language code, (such as "en" for English or "es" for Spanish), and not a country/region code, then any installed speech synthesis voice that expresses support for that generic, region-independent language may produce acceptable pronunciations for words in the specified language. See Language Identifier Constants and Strings for a comprehensive list of language codes.

The p and s elements may declare different languages in their xml:lang attributes than the language declared in the speak element. The Speech Platform SDK 11 supports multiple languages in SSML documents.

Note Note

The Microsoft Speech Platform Runtime 11 and Speech Platform SDK 11 do not include any engines for speech synthesis in a specific language. You must download a language pack (an engine for speech synthesis in a specific language) for each language in which you want to generate synthesized speech. See InstalledVoice for more information.

The other elements in the SSML document that also take the xml:lang attribute (voice, paragraph, and sentence) may declare different languages than the language declared in the speak element. The Speech Platform SDK 11 supports multiple languages in SSML documents.

Example

The following example creates a prompt that counts to ten; beginning in English, then in French, and finishing in German. Correct pronunciation of all the numbers will only be achieved if language packs for English, French, and German have been installed. As it processes the prompt, the SpeechSynthesizer object automatically selects and uses the default voice (if installed) for each language specified by an xml:lang attribute.

XML  Copy imageCopy Code
<?xml version="1.0" encoding="ISO-8859-1"?>
<speak version="1.0"
 xmlns="http://www.w3.org/2001/10/synthesis"
 xml:lang="en-US">

  <!-- Count in English -->
  <p> one, two, three </p>

  <!-- Count in French -->
  <p xml:lang="fr-FR"> quatre, cinq, six </p>

  <!-- Count in German -->
  <p xml:lang="de-DE"> sieben, acht, neun, zehn </p>

</speak>