cleanup.c

来自「speech signal process tools」· C语言 代码 · 共 78 行

C
78
字号
/*	 This material contains proprietary software of Entropic Processing, Inc. Any reproduction, distribution, or publication without the the prior	    written permission of Entropic Processing, Inc. is strictly prohibited. Any public distribution of copies of this work authorized in writing by Entropic Processing, Inc. must bear the notice			     	Copyright 1986, Entropic Proccessing, Inc	(C) 1985, Entropic Processing, Inc.*/#ifdef SCCSstatic char *sccsid = "@(#)cleanup.c	1.3 10/14/86 EPI";#endif#include <stdio.h>#include <sps/header.h>#include <sps/pitch.h>extern FILE *anaptr;extern int frmlen, debug_level;#define voiced 1#define unvoiced 0cleanup (flocn, fsize, ftype, p, coh_dst)   /* This routine converts very short voiced				   segments to unvoiced segments -- useful				   during silence periods */int     flocn, fsize, ftype;struct pitch *p;float coh_dst[];{    static int  plocn[20], psize[20];    static float pcoh_dst[20];    static int  knt = 0, seglnt = 0, segtype = -1;    int     i;    if (debug_level)	fprintf (stderr, "\t\tcleanup(%d,%d,%d,%8.2f)\n", flocn, fsize, ftype, coh_dst[0]);    if (segtype == -1) {	seglnt = frmlen;	segtype = ftype;    }    plocn[knt] = flocn;    psize[knt] = fsize;    pcoh_dst[knt] = coh_dst[0];    seglnt += fsize;    knt++;    if (segtype == ftype) {	if (ftype == voiced)	    for (i = 0; i < knt; i++)		put_pitch (anaptr, p, plocn[i], (float)psize[i], &pcoh_dst[i]);	knt = 0;	seglnt = 0;    }    else			/* There may be a state transition */    if (ftype == voiced) {	if (knt > 4 || seglnt > 2 * frmlen) {	    for (i = 0; i < knt; i++)		put_pitch (anaptr, p, plocn[i], (float)psize[i], &pcoh_dst[i]);	    knt = 0;	    seglnt = 0;	    segtype = ftype;	}    }    else    if (seglnt > frmlen) {	knt = 0;	seglnt = 0;	segtype = ftype;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?