Export (0) Print
Expand All

TtsEngineAction Enumeration


Namespace:  System.Speech.Synthesis.TtsEngine
Assembly:  System.Speech (in System.Speech.dll)

public enum class TtsEngineAction

Member nameDescription
BookmarkIndicates that TextFragment is to be used as the contents of a bookmark.

Corresponds to the <mark> XML tag in the SSML specification.

ParseUnknownTagIndicates that no action has been determined from SSML input.

The associated TextFragment is an unknown XML tag not part of the SSML standard.

This input that may be interpreted or ignored by at the discretion of a synthesis engine.

PronounceRequests that input TextFragment text be interpreted as phonemes.

Exact pronunciation is specified by the Phoneme member of the FragmentState object returned by the State property on TextFragment instances.

Corresponds to the <Phoneme> XML tag in the SSML specification.

SilenceIndicates that a TextFragment contains no text to be rendered as speech.

Duration of the silence is specified by the Duration member of the he FragmentState object returned by the State property on TextFragment instances.

Corresponds to the <Silence> XML tag in the SSML specification.

SpeakRequests that the associated TextFragment should be processed and spoken.

This is the default value of TtsEngineAction for a TextFragment,

Corresponds to the <speak> XML tag in the SSML specification

SpellOutIndicates that text values provided by a TextFragment through its TextToSpeak property are to be synthesize as individual characters.

This rendering includes punctuation, other than white space, as well as alphanumeric text.

For example thee associated text fragment "word!" should be synthsized into "w o r d exclamation point".

StartParagraphIndicates state of paragraph.

Corresponds to the <p> XML tag in the SSML specification

StartSentenceIndicates start of sentence.

Corresponds to the <s> XML tag in the SSML specification

TtsEngineAction represents requests for servicing a TextFragment. The actions correspond closely to elements in the SSML specification and are implemented on the text returned by the TextToSpeak property on a TextFragment.

The TtsEngineAction value associated with a TextFragment is returned by the State property.

Processing of the TtsEngineAction value returned by the State property is handled by a speech synthesizes implementation of the Speak method on a class derived from TtsEngineSsml.

The example below is part of a custom speech synthesis implementation inheriting from TtsEngineSsml, and using the use of TextFragment, FragmentState, and TtsEventID

The implementation of Speak



    • Translates Americanism to Britishisms in the text to be spoken.

    • If the EventInterest property on the ITtsEngineSite interfaces provided to the implementation support the WordBoundary event type, an event to drive a synthesizer progress meter is created.


internal struct UsVsUk
  internal string UK;
  internal string US;

  TextFragment [] newFrags=new TextFragment[frags.Length];
    newFrags[i].TextOffset = 0;
      //Us to UK conversion
      foreach (UsVsUk term in TransList) {
      newFrags[i].TextToSpeak.Replace(term.US, term.UK);
      //Generate progress meter events if supported
      if ((site.EventInterest & WordBoundaryFlag) != 0) {
      foreach (string s in subs) {
        int offset = newFrags[i].TextOffset;
        SpeechEventInfo spEvent = new SpeechEventInfo((Int16)TtsEventId.WordBoundary, 
                 s.Length, new IntPtr(offset));
        offset += s.Length;
        if (s.Trim().Length > 0) {
          SpeechEventInfo[] events = new SpeechEventInfo[1];
          events[0] = spEvent;
          site.AddEvents(events, 1);
  _baseSynthesize.Speak(newFrags, wfx, site);

.NET Framework


.NET Framework Client Profile

Supported in: 4



© 2014 Microsoft