Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 11 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
(老问题,但没有被接受的答案,并且在谷歌中显得相当高)
如果你真的想在 C++ 中执行此操作,你必须下载 SAPI SDK,它不是 Windows 的标准配置: http://www.microsoft.com/downloads/en /details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&displaylang=en ,选择 SpeechSDK51.exe
您可以在 SAPI 上找到的最佳文档不在 Web 上,而是在 SDK 本身中,文档/文件夹。 .chm 很好地解释了一切。 此处是一个附加链接让您开始。
然而,C++ 对你来说不是必需的,我强烈建议你用 C# 来做。它确实简单得多(没有 COM 组件,没有单独的 SDK,MSDN 上有更多文档,更多教程,...)。请参阅这篇 CodeProject 文章;你必须删除所有 GUI 的东西,以及所有语音合成的东西,你会发现,语音识别归结为 10 行代码。相当令人印象深刻。
编辑示例代码,未编译,未测试:
ta dah,完成
(Old question, but no accepted answer, and appears quite high in google)
If you really want to do this in C++, you have to download the SAPI SDK, which does not come standard with Windows : http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5e86ec97-40a7-453f-b0ee-6583171b4530&displaylang=en , select SpeechSDK51.exe
The best documentation you can find on SAPI is not on the web, it's in the SDK itself, in the Docs/ folder. The .chm explains everything really well. Here is an additional link to get you started.
However, it C++ is not a requirement for you, I strongly recommend you do it in C#. It's really much simpler (no COM components, no separate SDK, more doc on MSDN, more tutorials, ...) . See this CodeProject article; you'll have to remove all the GUI stuff, and all the speech synthesis stuff, and you'll see, speech recognition boild down to 10 lines of code. Quite impressive.
EDIT sample code, not compiled, not tested :
ta dah, done
Windows 为客户端和服务器提供语音识别引擎。两者都可以使用 C++ 或 .NET 语言进行编程。用于 C++ 编程的传统 API 称为 SAPI。客户端和服务器语音的 .NET 框架命名空间是 System.Speech 和 Microsoft.Speech。
SAPI 文档 - http://msdn.microsoft.com/ en-us/library/ms723627(VS.85).aspx
用于客户端识别的 .NET 命名空间是 System.Speech - http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx。 Windows Vista 和 7 包含语音引擎。
用于服务器识别的 .NET 命名空间是 Microsoft.Speech,10.2 版本的完整 SDK 可在 http://www.microsoft.com/downloads/en/details.aspx?FamilyID=1b1604d3-4f66-4241-9a21-90a294a5c9a4。语音引擎可免费下载。
许多早期的问题已经解决了这个问题。请参阅基于语音识别的原型和SAPI 和 Windows 7 问题 例如。
Windows provides speech recognition engines for both clients and servers. Both can be programmed with C++ or with .NET languages. The traditional API for programming in C++ is known as SAPI. The .NET framework namepsaces for client and server speech are System.Speech and Microsoft.Speech.
SAPI documentation - http://msdn.microsoft.com/en-us/library/ms723627(VS.85).aspx
The .NET namespace for client recognition is System.Speech - http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx. Windows Vista and 7 include the speech engine.
The .NET namespace for server recognition is Microsoft.Speech and the complete SDK for the 10.2 version is available at http://www.microsoft.com/downloads/en/details.aspx?FamilyID=1b1604d3-4f66-4241-9a21-90a294a5c9a4. The speech engine is a free download.
Lots of earlier questions have addressed this. See Prototype based on speech recognition and SAPI and Windows 7 Problem for examples.