Matlab在语音处理中用到了enframe对语音信号进行分帧处理。
我在网上查看了一下enframe的一些相关信息:
y=enframe(x,framelength,step);
x为信号向量,可以为航向量或者列向量,
framelength是每一帧的长度,
step 是指一帧与一帧之间移动的样点数,有的称为非重叠的长度,
分得的帧数是:nf = fix((nx-framelength+step)/step),
其中nx 是x的长度,y是framelengthnf的数组或者nfframelength的数组,其取决于x是行向量还是列向量。
//C++实现enframe分帧函数//输入://float* x:信号源(行向量)//int framelength:每一帧的长度//int step:一帧与一帧之间移动的样点数,有的称为非重叠的长度////输出://一个帧数*每一帧长度的二维数组static float** enframe(const float x[], int srclength, int framelength, int step)
{
int nf = floor((srclength - framelength + step) / step);//算出帧数
float** yenframe;//用来存放结果
yenframe = new float *[nf];
for (int i = 0; i < nf; i++)
{
yenframe[i] = new float[framelength];
}
int count = 0;
int startNo = 0;
while (count < nf)
{
for (int i = 0; i < framelength; i++)
{
yenframe[count][i] = x[startNo + i];
}
count++;
startNo += step;
}
return yenframe;
}
原文链接: https://www.cnblogs.com/GT4AI/p/4701333.html
欢迎关注
微信关注下方公众号,第一时间获取干货硬货;公众号内回复【pdf】免费获取数百本计算机经典书籍
原创文章受到原创版权保护。转载请注明出处:https://www.ccppcoding.com/archives/220208
非原创文章文中已经注明原地址,如有侵权,联系删除
关注公众号【高性能架构探索】,第一时间获取最新文章
转载文章受原作者版权保护。转载请注明原作者出处!