SpeechUI Class

Provides text and status information to the operating system in speech user interface to display to the user.

Namespace: System.Speech.Recognition
Assembly: System.Speech (in system.speech.dll)

public class SpeechUI
public class SpeechUI
public class SpeechUI
Not applicable.

The members of SpeechUI are used to indicate exact feed back to the end user through the user interface.

An application can return arbitrary text and success/failure information using SpeechUI.

The example below is a handler for a Grammar.SpeechRecognized event used by a Grammar designed to handle password input for the form "My password is …".

If a password is not present, or not valid, SendTextFeedback is used to send error information to the user interface.

grammar.SpeechRecognized +=
delegate(object sender, SpeechRecognizedEventArgs eventArgs) {
    SemanticValue semantics = eventArgs.Result.Semantics;
    RecognitionResult result=eventArgs.Result;

    if (!semantics.ContainsKey("Password")) {        SpeechUI.SendTextFeedback(eventArgs.Result,                                  "No Password Provided", false);
    } else {

        RecognizedAudio pwdAudio = result.GetAudioForWordRange(result.Words[3],
                                                    result.Words[result.Words.Count - 1]);
        MemoryStream pwdMemoryStream = new MemoryStream();
        if (!IsValidPwd(pwdMemoryStream)) {            string badPwd = System.IO.Path.GetTempPath() + "BadPwd" + (new Random()).Next().ToString() + ".wav";            FileStream waveStream = new FileStream(badPwd, FileMode.Create);            pwdAudio.WriteToWaveStream(waveStream);            waveStream.Flush();            waveStream.Close();            SpeechUI.SendTextFeedback(eventArgs.Result,                                      "Invalid Password", false);        }


Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0

Community Additions