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
Asked
Active
Viewed 137 times
1 Answers
1
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.

Community
- 1
- 1

Eric Brown
- 13,774
- 7
- 30
- 71
-
It is a telephony command and control application. I have written several apps to SAPI over the years and have tried to understand the complicated and confusing new interfaces. I was wondering is not writing to one of the namespaces and using SAPI and MMSYSTEM directly would not work. I agree that the server version (microsoft.speech) is what I would need rather than desktop (system.speech) for several reasons, but have no idea how to use any of the installed wave audio device driver inputs. In a major oversight, Microsoft seems to have not implemented .SetInputToAudioDeviceID. – FDecker Apr 07 '17 at 12:18
-
They only allow you to .SetInputToDefaultAudioDevice and .SetInputToAudioStream. In SAPI, I can do this in VB:Dim MMSysAudioIn1 As ISpeechMMSysAudio Set MMSysAudioIn1 = New SpMMAudioIn AudioIn1.DeviceId = PhoneLine1.WaveRecordID MMSysAudioIn1.Format.Type = SAFT8kHz16BitMono – FDecker Apr 07 '17 at 12:18
-
I have been researching for 2 weeks and can't see how to set the input for speech recognition to any input installed on the PC. I think I need .SetInputToAudioStream, but have no idea and can't find code in VB.NET to point the "wave in device ID" of a particular installed wave device. What if I even wanted a USB microphone that wasn't the default audio device? How can I point to it? – FDecker Apr 07 '17 at 12:26