资源简介
压缩包中包含mfcc特征文件,这个代码实现了用于语音mfcc特征的DTW匹配算法。
代码片段和文件信息
#include “stdafx.h“
#include “dtw.h“
#include
DTW::DTW()
{
pszMfcc1 = “./mfccout.txt“;
pszMfcc2 = “./mfccout1.txt“;
}
DTW::~DTW()
{
}
/*************************************************
Function: // void slipt(CString strInvector *pframe)
Description: // 将strIn按照空格这样的分隔符分割并转为float类型
Input: // CString strIn 输入待分割语句,
// vector *pframe 输出的float类型数组 转换结果
Return: // NULL
Others: // 2012/3/17
*************************************************/
void DTW::slipt(char* strInvector *pframe)
{
float x;
int i = 0;
int nsize = 1000;
string strtemp;
while (i {
if (strIn[i] != ‘ ‘)//get the char at the position i of strIn
{
//strcat(strtmppch);
strtemp.push_back(strIn[i]);
}
else
{
if (strtemp != ““)//acquire a whole number str style
{
x = atof(strtemp.c_str());//transform into float style
pframe->push_back(x);
//memset(strtemp064);
strtemp = ““;
}
}
i++;
}
nsize = pframe->size();
cout<
}
/*************************************************
Function: // bool loadF( vector> *MFCC_1 vector> *MFCC_2)
Description: // 从文本文件中读入MFCC特征并分别保存至 MFCC_1以及MFCC_2中
Input: // vector> *MFCC_1 存储模型文件mfcc特征向量的地址
// vector> *MFCC_2 存储待识别文件mfcc特征向量的地址
Return: // true 加载成功,False 加载失败
Others: // 2012/3/17
*************************************************/
bool DTW::loadF( vector> *MFCC_1 vector> *MFCC_2)
{
vector frame;
ifstream MfccFile1(pszMfcc1);
ifstream MfccFile2(pszMfcc1);
//open the mfcc1 file
//if ( !MfccFile1.Open(pszMfcc1CFile::typeText|CFile::modeReadWrite) )
//{
// cout<<“can not open the file mfcc1 “< // return 0;
//}
char strlinein[1000];
memset(strlinein321000);//将数据缓存部分均存为空格,空格为间隔位也为结束位;
//MfccFile1.getline(strlinein1000);
while (MfccFile1.getline(strlinein1000))
{
//slipt strlinein into float vectors
frame.swap(vector());
slipt(strlinein&frame);
MFCC_1->push_back(frame);
//cout< //cout< //put the data into MFCC_1
}
//load data from file into mfcc_2
memset(strlinein321000);
while (MfccFile2.getline(strlinein1000))
{
//slipt strlinein into float vectors
frame.swap(vector());
slipt(strlinein&frame);
MFCC_2->push_back(frame);
//cout< //cout< //put the data into MFCC_1
//linein;
}
return 1;
}
/*************************************************
Function: // float distanceF(vector a vector b)
Description: // 计算向量a和向量b的距离
Input: // vector a 模型mfcc特征向量
// vector b 待识别mfcc特征向量
Return: // 返回相应距离
Others: // 2012/3/19
*****
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6237696 2012-03-26 10:35 dtw\dtw\Debug\dtw.exe
文件 15040356 2012-03-26 10:35 dtw\dtw\Debug\dtw.ilk
文件 26323968 2012-03-26 10:35 dtw\dtw\Debug\dtw.pdb
文件 1876 2012-03-26 10:35 dtw\dtw\dtw\Debug\cl.command.1.tlog
文件 50386 2012-03-26 10:35 dtw\dtw\dtw\Debug\CL.read.1.tlog
文件 1016 2012-03-26 10:35 dtw\dtw\dtw\Debug\CL.write.1.tlog
文件 406 2012-03-20 10:29 dtw\dtw\dtw\Debug\dtw.exe.em
文件 472 2012-03-20 10:29 dtw\dtw\dtw\Debug\dtw.exe.em
文件 381 2012-03-26 10:35 dtw\dtw\dtw\Debug\dtw.exe.intermediate.manifest
文件 47 2012-03-26 10:35 dtw\dtw\dtw\Debug\dtw.lastbuildstate
文件 2501 2012-03-26 10:35 dtw\dtw\dtw\Debug\dtw.log
文件 766681 2012-03-26 10:35 dtw\dtw\dtw\Debug\dtw.obj
文件 1245184 2012-03-20 10:28 dtw\dtw\dtw\Debug\dtw.pch
文件 196 2012-03-20 10:28 dtw\dtw\dtw\Debug\dtw_manifest.rc
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
文件 2 2012-03-26 10:35 dtw\dtw\dtw\Debug\li
............此处省略47个文件信息
相关资源
- 疯狂跑酷游戏
- vb关于api编程的pdf电子书《Visual basi
- 异形窗体的win32 API实现
- C++ 连连看146451
- 吃豆人Win32小游戏
- [纯C语言 + Win32 API]一步一步写个围棋
- win32 API函数 MFC函数 msdn中文文档
- win32对话框tab control控件使用demo
-
Win32 Dialogba
sed Application - VC++ 轨迹运动源码
- 我自己写的扫雷源码Win32 API,C语言
- 使用Win32 API的相关知识实现矩阵的乘
- 编译C++需要的库文件win32 mak
- 汉诺塔 win32 演示程序
- DTW算法VC++实现 源代码非常好,注释非
- win32窗体贪吃蛇c++代码
- DTW算法 C语言代码
- DTW算法 C++实现
- USB 通讯 libusb-win32
- [纯C语言 + Win32 API]一步一步写个围棋
- VC++ 迷宫游戏
- VC/MFC 布局类
- Win32窗口创建源码 by浅墨
- c++.win32.扫雷游戏代码
- WIN32 select 模型之客户端
- C语言,设备管理系统,用win32写的界
- 赫夫曼树哈夫曼树 算法 编码 源代
- Win32——创建美观的按钮控件
- php-5.2.17-nts-Win32-VC6-x86.zip
- 新编Windows API参考大全全中文、win32
评论
共有 条评论