Search code examples
vb.netspeechsapi

Is there a reason I would use the Microsoft.Speech Namespace instead of directly using SAPI 5.4 in Visual Studio?


Speech in Visual Studio is very confusing. In other languages and even VB6, I have working code that uses SAPI 5.4 objects. I see there are the Microsoft.Speech and System.Speech objects in Visual Studio. I assume this is so I can have managed code. Can you still program directly to SAPI? What should I know about why I would want to use one method or the other? The code isn't even remotely similar. This application will run on Windows Server and be written in VB.NET


Solution

  • You might want to look at the answer to this question first.

    Given that you're running on Windows Server, you almost certainly want Microsoft.Speech rather than System.Speech for the following reasons:

    • Server doesn't include any SR engines by default; you have to install the Desktop Experience pack;
    • System.Speech requires training to work well;
    • Microsoft.Speech has SR engines that work well with lower-quality audio.

    You can still program directly to SAPI; the only real difference between Server SAPI and Desktop SAPI is the underlying SR engine. (The client-side API is exactly the same.)

    Programming directly to SAPI is more complicated, but gives you more control. I couldn't recommend one or the other without knowing what your ultimate goals are.