📄 ec_constants.h
字号:
// file: echoc_constants.h//// various constants used in the echo canceller code.//// make sure definitions are only made once//#ifndef __ECHOC_CONSTANTS#define __ECHOC_CONSTANTS//-----------------------------------------------------------------------------//// i/o related constants begin here////-----------------------------------------------------------------------------// the number of bytes in a speech sample (we assume 16 bit samples)//#define SAMPLE_SIZE 2// sampling frequency of input data//#define SAMPLE_FREQ 8000// the number of channels of data (we assume stereo data)//#define NCHAN 2// which channel of the stereo data is considered the reference signal//#define C_R 0// which channel of the stereo data is considered the signal plus echo//#define C_E 1// the maximum magnitude of a speech sample (used to prevent overflow)// and a scaling factor to make signals exist in the range [-1,1]//#define AMPL_SCALE_1 3.0518509e-05#define AMPL_SCALE_2 32767.0#define MAX_AMPL 1.0// the number of arguments expected from the command line (including the// program name//#define NARGS 1//-----------------------------------------------------------------------------//// algorithm constants begin here////-----------------------------------------------------------------------------// first-order high-pass filter//#define DEFAULT_GAMMA pow(2.0, -3.0)// the number of taps in the echo canceller (N)//#define DEFAULT_N 256// the number of samples used to update coefficients using the// the block update method (M)//#define DEFAULT_M 16// the adaptation speed (beta1) and max adaptation value// note that the max allowable adaptation value needs to be adjusted somewhat// depending on the block update interval (the less you update, the more// you must perturb the coefficients to keep up - but we shouldn't let// this get out of hand or the system goes unstable) It has also been// observed that there exits an inverse relationship between beta1 and the// filter length we choose. For example when the filter length was 128 a// beta1=pow(2.0, -11.0) sufficed to get convergence of the algorithm, but when// we used a filter length of 256 we had to lower beta1 to the present value.// #define DEFAULT_BETA1 pow(2.0, -13.0)#define MAX_BETA 16/DEFAULT_M// constants for the reference and near-end power computation//#define DEFAULT_SIGMA_LU pow(2.0, -7.0)#define DEFAULT_SIGMA_LY pow(2.0, -7.0)#define DEFAULT_ALPHA_ST pow(2.0, -5.0)#define DEFAULT_ALPHA_YT pow(2.0, -5.0)#define DEFAULT_CUTOFF pow(2.0, -15.0)// define the near-end speech hangover counter: if near-end speech// is declared, hcntr is set equal to hangt (see pg. 432)//#define DEFAULT_HANGT 600// define the residual error suppression threshold//#define DEFAULT_SUPPR -12//-----------------------------------------------------------------------------//// changes to the standard lms algorithm are documented here// we describe two changes useful for speech recognition research://// 1. exponential damping of the adaptation gain// 2. residual error suppression based on the near-end speech energy////-----------------------------------------------------------------------------//// in a departure from the standard lms algorithm, we add an// exponentially decaying weight to the adaptation constant. this// serves to slow the rate of adaptation the further into the file we get.//// the equation of this decay is://// beta_actual = max[beta * exp[-tau*(t - t0 - t_onset)]// u(t - t0 - t_onset), MIN_BETA]//// where tau is the decay constant, and t0 is measured from the first// onset of speech//// define the value of t0 in secs//#define DEFAULT_T0 5// define default value for tau//#define DEFAULT_TAU 1// define the minimum allowed value of beta, and the time it takes// for beta1 to decay to this value (in secs)//#define MIN_BETA DEFAULT_BETA1 * pow(2.0, -4.0)#define BETA_DECAY_TIME 30// we also need to define a threshold for which we decide that near-end// speech has begun. in a standard echo cancellation algorithm, we have an// outgoing signal that is typically larger than the echo. when the// outgoing speech is much larger than the echo, we declare this event the// onset of speech activity - this is t0. we need a threshold to// define this event. we use the ratio of the far-end speech to// near-end speech in db.//#define ONSET_THRESH -20// constants for error suppression//// in a second departure, we calculate the residual error suppression// as a percentage of the reference signal energy level. the threshold// is defined in terms of dB below the reference signal.//#define RES_SUPR_FACTOR -20// we need a dynamic level of suppression varying with the ratio of the// power of the echo to the power of the reference signal// this is done so that we have a smoother background. // we have a higher suppression when the power ratio is closer to// suppr_ceil and reduces logarithmically as we approach suppr_floor.//#define SUPPR_FLOOR -64#define SUPPR_CEIL -24// to avoid problems when the input data is zeroed out, we have a minimum// dB value specified for the ratio of the power of the echo to the power// of the reference signal//#define EC_MIN_DB_VALUE -70// end of include file#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -