我们要进行语言识别,那么就要先构建好平台——portaudio!
我们需要采集所需要的16KHZ频率,16比特的声音信号,我们就可以采用portaudio来实现这个功能。那么这个Portaudio怎么使用呢?请看!
http://www.cnblogs.com/haibindev/archive/2011/12/07/2277366.html
http://www.portaudio.com/
http://blog.csdn.net/killmice/article/details/8674563
其实还有别的方法,就是采用directshow:
DirectShow
http://edu.gamfe.com/tutor/d/42674.html
http://blog.sina.com.cn/s/blog_4d8205e40100q4gw.html
以下是具体步骤:http://portaudio.com/docs/v19-doxydocs/compile_windows.html (其实这个教程写得就十分perfect了,我就把我做到遇到的问题说一下吧!我基本上遇到了所有的问题) 当然,还有一篇博客:http://blog.csdn.net/yanmy2012/article/details/8090287 写得也挺好!
1、安装directx:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=3021d52b-514e-41d3-ad02-438a3ba730ba (如果安装不了的话,请把vs2012及更高版本的reditributed删除 )
2、安装
http://portaudio.com/docs/v19-doxydocs/compile_windows.html 这个是最好的!
http://blog.csdn.net/str999_cn/article/details/27326821
http://blog.sina.com.cn/s/blog_b8700d2f0102v0vw.html 不错的教程!
Open Project -> portaudio Properties and select "Configuration Properties" in the tree view. 这个就是改属性管理器的东西!
Without ASIO:
修改属性管理器进行一些配置设置:
Select "all configurations" in the "Configurations" combo box above. Select "All Platforms" in the "Platforms" combo box.
Now set a few options:
Required:
C/C++ -> Code Generation -> Runtime library = /MT
Optional:
C/C++ -> Optimization -> Omit frame pointers = Yes
Optional: C/C++ -> Code Generation -> Floating point model = fast
预处理定义:
Since the preprocessor definitions are different for each configuration and platform, you'll need to edit these individually for each configuration/platform combination that you want to modify using the "Configurations" and "Platforms" combo boxes.
To suppress PortAudio runtime debug console output, go to Project -> Properties -> Configuration Properties -> C/C++ -> Preprocessor. In the field 'Preprocessor Definitions', find PA_ENABLE_DEBUG_OUTPUT and remove it. The console will not output debug messages.
Also in the preprocessor definitions you need to explicitly define the native audio APIs you wish to use. For Windows the available API definitions are:
PA_USE_ASIO
PA_USE_DS (DirectSound)
PA_USE_WMME (MME)
PA_USE_WASAPI
PA_USE_WDMKS
PA_USE_SKELETON
For each of these, the value of 0 indicates that support for this API should not be included. The value 1 indicates that support for this API should be included. (PA_USE_SKELETON is not usually used, it is a code sample for developers wanting to support a new API).
点开:
3、问题
http://music.columbia.edu/pipermail/portaudio/2009-June/009210.html 2019的问题!http://write.blog.csdn.net/postedit/44056277
函数依赖项的问题,主要是opencv之前没有配好,坑爹的!终于让我干掉你这个函数依赖项: http://www.cnblogs.com/cuteshongshong/articles/4056365.html
一定要在属性管理器那里去搞!
还要那个ASIO下不了记得把和它相关的去掉!
http://blog.csdn.net/tianyuan521521/article/details/43638051 无法打开文件“KSguid.lib” 这个库呢我的就是在:
C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib
http://www.rosoo.net/a/201011/10526.html 总得到后面错误的结果。在Win32环境中是需要WMME和DS的
最后终于看到:
后来我又试了x64,因为安装了IPP的缘故。结果是:
表面上是生成了dll结果去那个目录下没有发现,而且有那个warning,所以我就:(任选一种)
- 在项目的C/C++->预处理器,预处理器定义那里加:
_CRT_SECURE_NO_DEPRECATE
- 在项目的stdafx.h中寻找#pragma once语句,在它的后面加入如下所示的宏定义: #define _CRT_SECURE_NO_DEPRECATE
- 在项目的stdafx.h中寻找#pragma once语句,在它的后面加入如下所示的编译控制语句 : #pragma warning(disable:4996)
当然,这时候dll没有生成的问题没有解决,但具体解决办法请看:
对于这个我要提特别说明,若在配置管理器哪那里设置了Release的,那么你的文件是在Debug那里找到portaudio_x64.lib和在Release底下找到portaudio_x64.dll。在下图中我还特别框出了x64,记得这里选x64,主要是为了配合后面IPP使用。这里的输出文件之前是没有的,我加进去了:$(Platform)\$(Configuration)/portaudio_x64.dll。要是找不到lib呢?请看:
http://zhidao.baidu.com/link?url=T0dN7yvaz81cjHihEkW36wVOINjH3lEkYmX5KPHNJFSXyPxYDRu-XBZT_GCYd08lflPsnUL-QMeZ4F
https://msdn.microsoft.com/zh-cn/library/67wc07b9UCYIv6iq
4、使用简介
具体在VS上怎么使用请参考我的下一篇博客:
http://blog.csdn.net/c602273091/article/details/44156707
1. 将portaudio/include下的头文件portaudio.h拷贝到当前工程目录下,并且包含进VS工程里。
2.将编译生成的portaudio_x86.dll,portaudio_x86.lib两个文件拷贝到工程目录下。
3.在工程的项目属性里设置:C/C++->常规->附加包含目录(如果第2步头文件已经拷贝到工程,此处不必再设置。)
4.链接器->输入->附加依赖项,输入portaudio_x86.lib。
http://blog.csdn.net/str999_cn/article/details/27368797
5、总结
在这里我就总结一下调用某个库的使用方法:直接看官方网站给的资料,比什么都清楚。还有就是在保持官方网站的步骤一致性之后遇到什么问题就去查什么问题!相信我,你不是第一个吃螃蟹的人!那么生成的dll和lib怎么用呢?
具体请看我的博客:
http://blog.csdn.net/c602273091/article/details/44156707