If only this app could speak…

Sign in to queue



How’s that to start off my second post to the Coding4Fun blog? A folksy, friendly greeting to try to set the tone for this and future posts. Where, a couple times a week, I’ll be posting about cool coding, development and tech stuff I find around the Net. Stuff that the people who just love to code might also find interesting. Now, on to the show…

There’s something compelling about computers and the spoken word. It just seems normal to expect that we should be able to have a conversation with our computers. For me it began with 2001, A Space Odyssey and the HAL9000 (or was it Star Trek and the Enterprise’s computer?) Since then, every time I see voice control or voice output from a computer or application I find myself drawn to it.

Code Gain - Building Applications that Can Talk


In this article we are going to explore the Speech API library that’s part of the TTS SDK that helps you reading text and speaking it. We’re going to see how to do it programmatically using C# and VB.NET and how to make use of LINQ to make it more interesting. The last part of this article talks about…… won’t tell you more, let’s see!


The Speech API library that we are going to use today is represented by the file sapi.dll which’s located in %windir%\System32\Speech\Common. This library is not part of the .NET BCL and it’s not even a .NET library, so we’ll use Interoperability to communicate with it (don’t worry, using Visual Studio it’s just a matter of adding a reference to the application.)


This article shows how simple it really is to have your C# or VB application talking to your users. In just a couple lines of code, you can quickly add voice output. We’re not talking pre-recorded sound bites or dialogue but real Text To Speech (TTS). Then the sky is the limit. You can add tweaks to improve the pronunciation, change voices and more. Oh have I said that if you have Windows Vista/7 that this capability is just waiting for you to use it already, free?

Here’s a few more links you might find interesting:


Post thumbnail cutesy of Robert Simmons

The Discussion

  • User profile image

    I think this is great but is missing one thing. A larger picture of HAL. I glanced over the document to make sure it was the right one merely looking for the picture then read it and realized that the picture was only in the top right corner and very small.

  • User profile image
    Venkata Krishna Chilakapati


  • User profile image

    @tumaru: haha

  • User profile image

    The free voice that comes with Windows Vista/7 is called Microsoft Anna. It is not state-of-the-art. Its inteligibility is not at all as high as the competition, its performance is poor and it cannot be really adjusted in any way except perhaps speed. Other voices from Nuance http://www.nuance.com/ , Acapela http://www.acapela-group.com/ and Loquendo http://www.loquendo.com/en/products/speech-server/ are so much more intelligible. The default voice (called Alex) that comes with Mac OSX is also extremely intelligible and it is so much better than the one in Vista/7. And all these other voices are more responsive that Microsoft Anna and so perform much better. Much worse, Microsoft Anna has not been improved for 5 years now while the competition has continuously released new versions. Mac OSX Alex can even take natural-sounding breaths between phrases. Moreover, in Vista Microsoft Narrator which uses Microsoft Anna had a serious bug whereby it would take a very long time of more than 1 second before speaking after the user had navigated to a new item on the screen, such as while cursoring down through a document or even the Start menu. You can imagine how hard it was to use Microsoft Anna in Vista then. How can a product as big as Vista be released with such a serious bug is beyond me. Even today with Windows 7, screen readers which use the SAPI voices are generally slow to respond and are full of bugs. I can only conclude that SAPI has serious performance or design flaws which have not been addressed for more than a decade.

    As I said, Anna is not at all adjustable. Also, very importantly it only supports English. You might say that developing a free synthetic voice for multiple languages that is easily tunable and performant would be very hard even for Microsoft. And yet, volunteers without any corporate assistance, from what I understand, have created and released as open source the free synthetic voice espeak. It can speak something like 40 languages, even obscure ones. And it is extremely performant and adjustable, such as its peech and intonation, even though it might not be as intelligible as paid voices from Nuance. You can get it from Sourceforge and incorporate it into your Windows applications according to its open source license and do it very easily as it is very lightweight and has an extremely small footprint. If a small group of volunteers can do this, why not a big company.

Add Your 2 Cents