Sometime soon, I plan on releasing a cool application that uses text-to-speech. Some of you might have been curious about the implementation about text-to-speech for quite a while. The implementation of text-to-speech really isn’t that hard as long as you use Microsoft’s Speech API (SAPI). The current version of SAPI that you can download from Microsoft is 5.1, however if your running Windows Vista then you will have 5.3 preinstalled. If you have any version of Microsoft Office installed then you more then likely have this already, If not a download link is below.
The following link (Giving Computers a Voice) will lead you to a Microsoft site that will show you how to create a project and get a basic text to speech application up and running in VB .Net or c# in no time!
SAPI is the speech API that gives applications access to speech recognition and text-to-speech (TTS) engines. This article focuses on TTS. For TTS, SAPI takes text as input and uses the TTS engine to output that text as spoken audio. This is the same technology used by the Windows accessibility tool, Narrator. Every version of Windows since XP has shipped with SAPI and an English TTS engine.
TTS puts user’s ears to work. It allows applications to send information to the user without requiring the user’s eyes or hands. This is a very powerful output option that isn’t often utilized on PCs.
Three steps are needed to use TTS in a managed application:
Create an interop DLL
Since SAPI is a COM component, an interop DLL is needed to use it from a managed app. To create this, open the project in Visual Studio. Select the Project menu and click Add Reference. Select the COM tab, select “Microsoft Speech Object Library” in the list, and click OK. These steps add this reference to your project and create an Interop.SpeechLib.dll in the same folder as your executable. This interop DLL must always be in the same folder as your .exe to work correctly.
Reference the interop namespace
Include this namespace in your application. In C#, add
using SpeechLib;
; in VB, addImports SpeechLib
.call Speak()
Create a SpVoice object and call Speak():
Visual C#
SpVoice voice = new SpVoice(); voice.Speak("Hello World!", SpeechVoiceSpeakFlags.SVSFDefault);
Visual Basic
voice = New SpVoice voice.Speak("Hello World!", SpeechVoiceSpeakFlags.SVSFDefault)
If your running Windows Vista, and your planning on really diving deep into Microsoft’s Speech API (SAPI) version 5.3 then check out the following MSDN article Microsoft Speech API 5.3.
For those of you who are looking for various Microsoft blogs that consistently blog about Speech related technologies then check out the following:
Share this post
Twitter
Facebook
Reddit
LinkedIn
Email