91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 8KB
    文件類型: .c
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2021-05-10
  • 語言: 其他
  • 標(biāo)簽: DTW??C??源碼??

資源簡介

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??????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??????if?((y[i]?=?malloc(params?*?sizeof(float)))?==?NULL)??
?????fprintf(stderr“Memory?allocation?error?(y)\n“);??
??
?????/*?allocate?memory?for?Dist?*/??
??
if?((Dist?=?mallo

評論

共有 條評論