⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 smartana.c

📁 speech signal process tools
💻 C
字号:
/*---------------------------------------------------------------------------+|									     || 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 Processing, Inc."		     |----------------------------------------------------------------------------*/#ifdef SCCSstatic char *sccs_id = "@(#)smartana.c	1.2 9/8/86 EPI";#endif#include <stdio.h>#define voiced 1#define unvoiced 0#define UU 0#define UV 1#define VU 2			/* 10 binary */#define VV 3			/* 11 binary */extern float num[];smartana(locn, lpcfilter, order, inpbuf, blksze, correct_flag, sig_energy)int     locn, *correct_flag, order, blksze;float lpcfilter[], inpbuf[], sig_energy;    {	float   peak = 0;	int     n, wt, i, j;	float   tmp[100], c2[100], k1, k2, comp_gain, t2;	*correct_flag = 0;/* Compute gain and rc's of actual speech from that of pre-emphasized signal */	n = order + 1;	/* Compute composite filter coefficients */	lpcfilter[0] = -1.0;	lpcfilter[n] = 0.0;	for (i = 1; i <= n; i++)	    c2[i] = lpcfilter[i] + lpcfilter[i - 1] * num[1];	/* Compute gain of composite filter */	comp_gain = 1.0;	k1 = 0.0;	for (i = n; i > 0; i--)	{	    k2 = k1;	    k1 = c2[i];	    t2 = 1.0 - k1 * k1;	    comp_gain *= t2;	    for (j = 1; j <= i - 1; j++)		tmp[j] = (c2[j] + k1 * c2[i - j]) / t2;	    for (j = 1; j <= i - 1; j++)		c2[j] = tmp[j];	}	comp_gain = 1.0 / comp_gain;/* Obtain peak/rmsval of pre-emphasized signal */	for (i = 0; i < blksze; i++)	{	    float   t = inpbuf[i];	    t = t * t;	    if (t > peak)		peak = t;	}	peak = peak / sig_energy;	wt = 0;	if (peak < 8)	{	    if (lpcfilter[1] < -1.0)		wt++;	    if (comp_gain < 8)		wt++;	    if (k1 < 0.5)		wt++;	    if (wt > 1)		*correct_flag = 1;	    else		*correct_flag = 0;	}    }

⌨️ 快捷键说明

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