📄 cep.c
字号:
/*********************************************************************
1.计算倒谱系数
2.计算倒谱距离
*********************************************************************/
#include "math.h"
#include "VoiceProcess.h"
#include "Dsplib.h"
//extern int PitchDataIn[800];
extern DATA fft[WindowsLong]; //傅立叶变换
#pragma DATA_SECTION(h,".FIRCOEFF");
DATA h[FIRSTEP];
/************************* CEP *************************************/
float VoiceIn[WindowsLong]; //原始数据
float VoicePreEmphasisOut[WindowsLong]; //预加重后数据
float VoiceHammingOut[WindowsLong]; //加窗后数据后
float DisCep_ss[64]; // 倒谱距离
float DisCepVar;
float W[WindowsLong]; //海明窗系数
float REF[LpcNumber]; //反射系数
float ALF[LpcNumber]; //LPC系数
float CEP[CepNumber]; //倒谱系数
float PRECEPD[CepNumber]; //预测倒谱系数
float CORREL[LpcNumber]; //自相关
void DisCep(void); //倒谱距离
void PreCep(void); //倒谱预测值更新
void PreCep_1(void);
void Hamming(void); //计算汉明窗系数
void ComputerCep(void);
void Init_coeff(void);
void PreEmphasis(void); //预加重
void AddHamming(void); //加汉明窗
void PreEmphasis2(void); //预加重
void AddHamming2(void); //加汉明窗
static void ComputeCorrel(void);//计算自相关函数
static void Corref(void); //由自相关函数计算LPC预测系数和反射系数
static void alfcep(void); //由LPC预测系数计算LPC倒谱系数
void Init_CEP_coeff(void);
/**************************************************************************/
extern Bool int_flag; //中断标志
Uint16 ZhenYi_Fb=0;
extern Uint16 Zhen;
extern Uint16 ZhenYi_F; //帧移标志
extern void SoundOut(void);
#define CepN 20 // 红灯灭标志
float Average=0; //平均幅度
Bool CepFlag; // 置亮灯标志
float Power[64];
float PowerNew;
extern float PowerTime,PowerAverage,Weight;
/**************************************************************************/
/*------------------------------------------------------------------
功能:预加重
计算方法:1-0.98Z^-1;
输入:VoiceIn[]
数据长度
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -