?? getarspec.c
字號:
/* * This material contains proprietary software of Entropic Speech, Inc. * Any reproduction, distribution, or publication without the prior * written permission of Entropic Speech, Inc. is strictly prohibited. * Any public distribution of copies of this work authorized in writing by * Entropic Speech, Inc. must bear the notice * * "Copyright (c) 1986, 1987 Entropic Speech, Inc.; All rights reserved" * *//*--------------------------------------------------------------+| || get_arspect -- compute max-entropy spectrum from residual || power and filter coefficients || || by Shankar Narayan, EPI; enhancements by Rod Johnson. || || Module: getarspec.c || || Accepts an array c of analysis filter coefficients of given || order, a residual energy renergy, a sampling frequency || sampfreq, and a number n of frequencies. Computes an array || y of (log) spectral power densities in db at n equispaced || frequencies. Calls getfft to compute a discrete Fourier || transform. || | +--------------------------------------------------------------*/#ifdef SCCS static char *sccs_id = "@(#)getarspec.c 1.2 6/25/87";#endif#include <stdio.h>#include "getarspec.h"typedef struct complex { double real; double imag;} COMPLEX ;double log10(), sqrt();extern debug_level;get_arspect(c, order, renergy, sampfreq, y, n) int order, sampfreq, n; float c[], renergy, y[];{ double t; int i; static COMPLEX temp[DFTMAX]; /* Size defined in getarspec.h */ int dftsize = 2*(n-1); c[0] = -1.0; if (debug_level) fprintf(stderr, "Filter coefficients:\n"); for (i = 0; i < dftsize; i++) { temp[i].real = (i <= order) ? c[i] : 0.0; temp[i].imag = 0.0; if (debug_level) { fprintf(stderr, "%lf\t", temp[i].real); if (i%5 == 4 || i == dftsize - 1) fprintf(stderr, "\n"); } } get_fft_comp(temp, dftsize); for (i = 0; i < n; i++) { t = temp[i].real * temp[i].real + temp[i].imag * temp[i].imag; if (t < .0000001) t = 0.0000001; y[i] = 10.0 * log10((2.0*renergy) / (t*sampfreq)); }}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -