资源简介
DTW算法的C源码,希望对研究语音识别算法的各位有帮助。
代码片段和文件信息
#include
#include
#include
#define VERY_BIG (1e30)
/* dtw.c */
/* VERSION 2.0 Andrew Slater 20/8/1999 */
/* Latest changes 3/2006 by John Coleman */
/* DEscriptION */
/* Compute a distance matrix on 2 multi-parameter vectors from 2 utterances
and perform dynamic time warping on the distance matrix */
/* INPUT: */
/* Two ASCII parameter files of the format:
filex:
X1a X1b ... X1n
X2a X2b ... X2n
...
filey:
Y1a Y1b ... Y1n
Y2a Y2b ... Y2n
...
where a b ... n are parameters (e.g. f0 tongue-tip x co-ordinate)
1 ... n is a time series
X and Y are 2 utterances
Distance is calculated as:
Dist[x1][y1] = (X1a - Y1a)^2 + (X1b - Y1b)^2 + ... + (X1n - Y1n)^2 etc.
*/
/* OUTPUTS: */
/* output file: best alignment of the 2 parameter files */
/* glob: sum of global distances useful as a similarity measure */
int main(argc argv)
int argc;
char *argv[];
{
double **globdist;
double **Dist;
double top mid bot cheapest total;
unsigned short int **move;
unsigned short int **warp;
unsigned short int **temp;
unsigned int I X Y n i j k;
unsigned int xsize = atoi(argv[4]);
unsigned int ysize = atoi(argv[5]);
unsigned int params = atoi(argv[6]);
unsigned int debug; /* debug flag */
float **x **y; /*now 2 dimensional*/
FILE *file1 *file2 *glob *debug_file *output_file;
if (argc <7 || argc > 8)
{fprintf(stderr“Usage: dtw infile1 infile2 outfile xsize ysize params [debug_file]\n“);
exit(1);
}
if (argc == 8)
{
/* open debug file */
if ((debug_file = fopen(argv[7]“wb“)) == NULL)
{fprintf(stderr“Cannot open debug file\n“);
exit(1);
}
debug = 1;
}
/* open x-parameter file */
if ((file1=fopen(argv[1]“rb“))==NULL)
{fprintf(stderr“File %s cannot be opened\n“argv[1]);
exit(1);
}
/* open y-parameter file */
if ((file2=fopen(argv[2]“rb“))==NULL)
{fprintf(stderr“File %s cannot be opened\n“argv[2]);
exit(1);
}
if (debug==1) fprintf(debug_file“xsize %d ysize %d params %d\n“xsizeysizeparams);
/* allocate memory for x and y matrices */
if ((x = malloc(xsize * sizeof(float *))) == NULL)
fprintf(stderr“Memory allocation error (x)\n“);
for (i=0; i < xsize; i++)
if ((x[i] = malloc(params * sizeof(float))) == NULL)
fprintf(stderr“Memory allocation error (x)\n“);
if ((y = malloc(ysize * sizeof(float *))) == NULL)
fprintf(stderr“Memory allocation error (y)\n“);
for (i=0; i < ysize; i++)
if ((y[i] = malloc(params * sizeof(float))) == NULL)
fprintf(stderr“Memory allocation error (y)\n“);
/* allocate memory for Dist */
if ((Dist = mallo
相关资源
- O2S.Components.PDFRender4NET_V4.5.1
- LegacyImageEffects资源包.rar
- modbus tcp master 和slave 谨慎
- TMS320VC5509TMS320VC5509电路原理图--Altiu
- GA change PID
- pesq算法源代码c源代码
- OPCProxy.dll等相关支持库
- Echart动态加载数据
- TSCLIB.dll TSCLIB.lib 32位和64位都有。
- 3D FFT基于CUDA的并行处
- my_jni_s_call_d_2019_0327_1750.7z
- Desk Calculator
- TCPIP协议的FLash讲解动画(共15节)
- 卡尔曼SOC算法源代码
- 传送带产品计数器的设计LCD显示51单片
- AxMSTSCLib
- ctf加解密小结
- Dash激活文件license
- wince6.0 sn
- TestCaseMigratorPlus.exe
- iar 8.50 patcher
- PCF8574T中文数据手册.pdf
- shc-3.8.3.tgz
- siemens_plc控制步进电机
- 基于FPGA的PCI接口设计
- 影院票务管理系统
- xss源码 最新版源码
- 软件著作权合作开发协议.docx
- arcgis server 10.2.2 许可文件
- fme2012 licgen.exe
评论
共有 条评论