To use the Microsoft Speech SDK with a C# program

  • Save the Interop.SpeechLib.dll file into your project directory.

  • Add a reference to the above dll to your c# project thru the Visual Studio.Net:Project:Add Reference menu.

  • Add the following using statement to the top of your c# file:
         using SpeechLib;
    
  • Add the following code to your speak function:
         SpeechVoiceSpeakFlags SpFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
         SpVoice Voice = new SpVoice();
    
         Voice.Speak("The time is bla bla bla", SpFlags);
    
         Voice.WaitUntilDone(Timeout.Infinite);
    
  • That's it! Compile it and run it.

    Note: the Interop.SpeechLib.dll file was obtained from the C:\Program Files\Microsoft Speech SDK 5.1\Samples\CSharp\SimpleTTS\obj directory after downloading the Microsoft Speech SDK 5.1 from Microsoft. The SDK is huge, but it has extra voices and more sample programs. You can download the whole speech SDK from the links below.

  • Microsoft Speech Site
  • Microsoft Speech SDK 5.1