资源简介
文件包含C语言和Matlab版本,其中对注释部分对AGC原理进行了详细介绍
代码片段和文件信息
/******************************************************************************
**
** Function : AGC()
**
** Description : AGC algorithm is used to automatically adjust the
** speech level of an audio signal to a predetermined
** value noramally in db.
**
** Arguments:
** float *x : input vector (range from -1 to 1 )
** float *y : output vector (range from -1 to 1 )
** float gain_level : output power level in db
** int N : number of samples or frame length
**
** Inputs:
** float *x
** float gain_level
** int N
**
** Outputs:
** float *y
**
** Return value : None
**
** NOTE : For more details refer matlab files.
**
** Programmer : Jaydeep Appasaheb Dhole
** : Associate Software Engineer ( DSP )
** : Aparoksha Tech. Pvt. Ltd. Bangalore.
** : http://www.aparoksha.com
** :
**
** Date : 26 May 2006.
******************************************************************************/
#include
void AGC(float *x float *y float gain_level int N)
{
int i;
float energy output_power_normal K;
/* ouput power gain level is in db convert it into normal power */
output_power_normal = (float)pow((double)10(double)(gain_level/10));
/* Calculate the energy of the signal */
energy = 0;
for(i = 0; i < N; i++)
energy += x[i] * x[i];
/* calculate the multiplication factor */
K = (float)sqrt ((output_power_normal*N)/energy);
/* scale the input signal to achieve the required output power */
for(i = 0; i < N; i++)
y[i] = x[i] * K ;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1888 2006-05-26 13:11 AGC.c
文件 7054 2006-06-01 19:37 AGC.m
文件 2232 2006-05-10 17:52 data.mat
文件 4288 2006-06-01 19:23 data2.mat
文件 1790 2006-05-12 17:20 input.dat
文件 2766 2006-05-26 13:10 main.c
- 上一篇:拓扑排序C++代码
- 下一篇:C++课程设计报告-科学计算器加强版.zip
评论
共有 条评论