资源简介
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
相关资源
- res10_300x300_ssd_iter_140000.caffemodel与dep
- scratch 第1课 翻跟斗的小猫(入门)
- stm32f407上的两个can发送和接收例程
- Scrach 欢乐狙击手.sb2
- 04741计算机网络原理知识点整理.docx(
- Wolfram Mathematica 矩阵初等变换函数(
- pscad近海风电模型 Fortran语言
- 程序员专用字体YaHei.Consolas.1.11b42517
- scratch3.0 源程序(说相声)
- AutoCAD永久去教育版破解补丁
- 开源1A锂电池充电板TP4056原理图+PCB
- m1卡 ic卡可选择扇区初始化加密软件
- TSCC.exe
- 欧姆龙CP1系列单轴定位PLC程序.cxp
- 用Beckhoff(倍福)PLC读写巴鲁夫RFID
- CVSNT 完整覆盖版防TortoiseCVS中文乱码
- pfc 使用说明.doc
- Scratch 飞机大战.sb3
- STC8951系列单片机中方指南
- 《Visual Prolog 基础类》 中文参考.chm
- 我的世界源码(易语言版)
- Omron ETN21模块进行modbustcp通讯
- 基于ACCESS的生产管理信息系统.mdb
- CANopen使用手册_埃斯顿
- Scratch 吃豆人追踪者.sb3
- labview编程软件滤波器以及编写程序设
- Scratch 变脸(将人物图片变成各种各样
- 我的界面(visual foxpro)源码
- oracle数据迁移项目实施方案
- CanuMobiSim
评论
共有 条评论