资源简介
项目接入语音识别技术进行语音控制请看博文教程:http://blog.csdn.net/sac761/article/details/52751370
本demo不是完整例子demo只是博文配套作者修改过的对应的一些代码,学习离线语音识别,命令词控制系统请看博文。
代码片段和文件信息
/*
@file
@brief 基于录音接口和MSC接口封装一个MIC录音识别的模块
@author taozhang9
@date 2016/05/27
*/
#include
#include
#include
#include “../../include/qisr.h“
#include “../../include/msp_cmn.h“
#include “../../include/msp_errors.h“
#include “./include/winrec.h“
#include “./include/speech_recognizer.h“
#ifdef _WIN64
//#pragma comment(lib“../../lib/msc_x64.lib“) //x64
#else
#pragma comment(lib“C:/of_v0.9.0_vs_release/examples/AR/MarkerAR/lib/msc.lib“) //x86
#endif
#define SR_DBGON 0
#if SR_DBGON == 1
# define sr_dbg printf
//# define __FILE_SAVE_VERIFY__ /* save the recording data into file ‘rec.pcm‘ too */
#else
# define sr_dbg
#endif
#define DEFAULT_FORMAT \
{\
WAVE_FORMAT_PCM \
1 \
16000 \
32000 \
2 \
16 \
sizeof(WAVEFORMATEX) \
}
/* internal state */
enum {
SR_STATE_INIT
SR_STATE_STARTED
};
/* for debug. saving the recording to a file */
#ifdef __FILE_SAVE_VERIFY__
#define VERIFY_FILE_NAME “rec.pcm“
static int open_stored_file(const char * name);
static int loopwrite_to_file(char *data size_t length);
static void safe_close_file();
#endif
#define SR_MALLOC malloc
#define SR_MFREE free
#define SR_MEMSET memset
#ifdef __FILE_SAVE_VERIFY__
static FILE *fdwav = NULL;
static int open_stored_file(const char * name)
{
fdwav = fopen(name “wb+“);
if(fdwav == NULL) {
printf(“error open file failed\n“);
return -1;
}
return 0;
}
static int loopwrite_to_file(char *data size_t length)
{
size_t wrt = 0 already = 0;
int ret = 0;
if(fdwav == NULL || data == NULL)
return -1;
while(1) {
wrt = fwrite(data + already 1 length - already fdwav);
if(wrt == (length - already) )
break;
if(ferror(fdwav)) {
ret = -1;
break;
}
already += wrt;
}
return ret;
}
static void safe_close_file()
{
if(fdwav) {
fclose(fdwav);
fdwav = NULL;
}
}
#endif
static void end_sr_on_error(struct speech_rec *sr int errcode)
{
if(sr->aud_src == SR_MIC)
stop_record(sr->recorder);
if (sr->session_id) {
if (sr->notif.on_speech_end)
sr->notif.on_speech_end(errcode);
QISRSessionEnd(sr->session_id “err“);
sr->session_id = NULL;
}
sr->state = SR_STATE_INIT;
#ifdef __FILE_SAVE_VERIFY__
safe_close_file();
#endif
}
static void end_sr_on_vad(struct speech_rec *sr)
{
int errcode;
int ret;
const char *rslt;
if (sr->aud_src == SR_MIC)
stop_record(sr->recorder);
sr->state = SR_STATE_INIT;
ret = QISRAudioWrite(sr->session_id NULL 0 MSP_AUDIO_SAMPLE_LAST &sr->ep_stat &sr->rec_stat);
/*if (ret != 0) {
sr_dbg(“write LAST_SAMPLE failed: %d\n“ ret);
QISRSessionEnd(sr->session_id “write err“);
return ret;
}*/
sr->rec_stat = MSP_AUDIO_SAMPLE_CONTINUE;
while(sr->rec_stat != MSP_REC_STATUS_COMPLETE ){
rslt = QISRGetResult(sr->session_id &sr->rec_stat 0 &errcode);
if (rslt && sr->notif.on_result)
sr->noti
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 2847 2016-10-07 16:43 asr_record_demo\include\speech_recognizer.h
文件 2922 2016-06-26 23:54 asr_record_demo\include\winrec.h
文件 11256 2016-10-06 16:32 asr_record_demo\speech_recognizer.c
文件 11958 2016-10-06 13:39 asr_record_demo\winrec.c
目录 0 2016-10-07 16:43 asr_record_demo\include
目录 0 2016-10-07 21:42 asr_record_demo
----------- --------- ---------- ----- ----
28983 6
- 上一篇:蓝牙的测试方法和标准
- 下一篇:利用FSVM实现对手写数字的识别
相关资源
- YS-LDV7语音识别模块使用手册V1.2
- Qt访问百度语音识别服务器,简单测试
- Delphi7 应用微软Speech SDK 5.4SAPI 5.4语音
- qt 语音合成 、识别
- 语音识别论文
- 基于DTW算法的语音识别原理与实现(
- LD3320原理图schdoc
- 小程序语音识别-NodeJs版
- 百度语音识别后评测打分
- ROS结合科大讯飞的语音识别包
- arduino_code.rar
- 智能语音识别避障机器人电路模块设
- 语音识别系统源码和开发文档
- 基于DTW的语音识别
- 语音识别项目案例
- tensorflow语音识别完整代码
- SPRO 5.0 用户手册PDF
- ld3320语音识别程序
- DTW算法C源码语音识别算法
- 百度语音识别 Unity插件
- labview语音识别系统设计
- SpeechSDK Demo微软语音识别演示中文和日
- kaldi语音识别教程
- AVR单片机语音识别电路模块设计
- 采用FPGA语音识别系统电路设计
- unity讯飞语音识别demowindows平台
- Unity语音识别Demo,基于百度AI,全平台
- 基于STMF103C8T6与LD3320语音模块带STC11识
- pocketsphinx在windows下的中文语音识别
- 语音识别测试
评论
共有 条评论