PromptBuilder::AppendSsml Method (Uri^)

 

Appends the SSML file at the specified URI to the PromptBuilder object.

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

public:
void AppendSsml(
	Uri^ ssmlFile
)

Parameters

ssmlFile
Type: System::Uri^

A fully qualified URI to the SSML file to append.

The SSML file must be an XML-format file that conforms to the Speech Synthesis Markup Language (SSML) Version 1.0 specification.

You can also append SSML markup as a string using AppendSsmlMarkup.

The example that follows creates a PromptBuilder object and appends the contents of an SSML file using the AppendSsml method.

using System;
using System.Speech.Synthesis;

namespace SampleSynthesis
{
  class Program
  {
    static void Main(string[] args)
    {

      // Initialize a new instance of the SpeechSynthesizer.
      using (SpeechSynthesizer synth = new SpeechSynthesizer())
      {

        // Configure the audio output. 
        synth.SetOutputToDefaultAudioDevice();

        // Create a PromptBuilder object and append a file that defines an SSML prompt.
        PromptBuilder ssmlFile = new PromptBuilder();
        ssmlFile.AppendSsml(new Uri("c:\\test\\Weather.ssml"));

        // Speak the contents of the SSML prompt.
        synth.Speak(ssmlFile);
      }

      Console.WriteLine();
      Console.WriteLine("Press any key to exit...");
      Console.ReadKey();
    }
  }
}

The following is the SSML file that the preceding example references.

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

  <s> The weather forecast for today is partly cloudy with some sun breaks. </s>

</speak>

.NET Framework
Available since 3.0
Return to top
Show: