首页 > 编程语言 > 详细

matlab enframe函数 C++实现

时间:2015-08-05 12:07:04      阅读:609      评论:0      收藏:0      [点我收藏+]

Matlab在语音处理中用到了enframe对语音信号进行分帧处理。

我在网上查看了一下enframe的一些相关信息:

y=enframe(x,framelength,step);

x为信号向量,可以为航向量或者列向量,

framelength是每一帧的长度,

step 是指一帧与一帧之间移动的样点数,有的称为非重叠的长度,

分得的帧数是:nf = fix((nx-framelength+step)/step),

其中nx 是x的长度,y是framelength*nf的数组或者nf*framelength的数组,其取决于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; }

 

matlab enframe函数 C++实现

原文:http://www.cnblogs.com/GT4AI/p/4701333.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!