Wednesday, April 21, 2010

Microsoft SAPI in C# and Java

Microsoft SAPI is the Speech API that comes with the Speech SDK which can be downloaded from Microsoft's website. Anyhow, it's included with Visual Studio 2005+ and with the newer version of Windows. These examples were written with 5.4.

Here is a Java Example:
var voice = new ActiveXObject("SAPI.SpVoice");
voice.Speak("Microsoft Surface is cool!");

Here is a C# Example:
First reference the Speech Library

//add the code to main:
using SpeechLib;

void SpeakAsync(string x)
SpVoice voice = new SpVoice();
SpeechLib.SpeechVoiceSpeakFlags SpFlags =

//To use type in main class:
SpeakAsync("I want to read this");

1 comment: