压缩包中包含mfcc特征文件,这个代码实现了用于语音mfcc特征的DTW匹配算法。
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 6237696 2012-03-26 10:35 dtwdtwDebugdtw.exe
文件 15040356 2012-03-26 10:35 dtwdtwDebugdtw.ilk
文件 26323968 2012-03-26 10:35 dtwdtwDebugdtw.pdb
文件 1876 2012-03-26 10:35 dtwdtwdtwDebugcl.command.1.tlog
文件 50386 2012-03-26 10:35 dtwdtwdtwDebugCL.read.1.tlog
文件 1016 2012-03-26 10:35 dtwdtwdtwDebugCL.write.1.tlog
文件 406 2012-03-20 10:29 dtwdtwdtwDebugdtw.exe.embed.manifest
文件 472 2012-03-20 10:29 dtwdtwdtwDebugdtw.exe.embed.manifest.res
文件 381 2012-03-26 10:35 dtwdtwdtwDebugdtw.exe.intermediate.manifest
文件 47 2012-03-26 10:35 dtwdtwdtwDebugdtw.lastbuildstate
文件 2501 2012-03-26 10:35 dtwdtwdtwDebugdtw.log
文件 766681 2012-03-26 10:35 dtwdtwdtwDebugdtw.obj
文件 1245184 2012-03-20 10:28 dtwdtwdtwDebugdtw.pch
文件 196 2012-03-20 10:28 dtwdtwdtwDebugdtw_manifest.rc
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink-cvtres.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink-cvtres.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2532-cvtres.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2532-cvtres.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2532.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2532.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2708-cvtres.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2708-cvtres.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2708.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.2708.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.4304-cvtres.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.4304-cvtres.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.4304.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.4304.write.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.4964-cvtres.read.1.tlog
文件 2 2012-03-26 10:35 dtwdtwdtwDebuglink.4964-cvtres.write.1.tlog
............此处省略47个文件信息
#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 dtwdtwDebugdtw.exe
文件 15040356 2012-03-26 10:35 dtwdtwDebugdtw.ilk
文件 26323968 2012-03-26 10:35 dtwdtwDebugdtw.pdb
文件 1876 2012-03-26 10:35 dtwdtwdtwDebugcl.command.1.tlog
文件 50386 2012-03-26 10:35 dtwdtwdtwDebugCL.read.1.tlog
文件 1016 2012-03-26 10:35 dtwdtwdtwDebugCL.write.1.tlog
文件 406 2012-03-20 10:29 dtwdtwdtwDebugdtw.exe.em
文件 472 2012-03-20 10:29 dtwdtwdtwDebugdtw.exe.em
文件 381 2012-03-26 10:35 dtwdtwdtwDebugdtw.exe.intermediate.manifest
文件 47 2012-03-26 10:35 dtwdtwdtwDebugdtw.lastbuildstate
文件 2501 2012-03-26 10:35 dtwdtwdtwDebugdtw.log
文件 766681 2012-03-26 10:35 dtwdtwdtwDebugdtw.obj
文件 1245184 2012-03-20 10:28 dtwdtwdtwDebugdtw.pch
文件 196 2012-03-20 10:28 dtwdtwdtwDebugdtw_manifest.rc
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
文件 2 2012-03-26 10:35 dtwdtwdtwDebugli
............此处省略47个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)