Framing and windowing audio signal

5 次查看(过去 30 天)
Iam using the code
Y=waveread(' ');
w_length=128;
m=length(Y);
numFrames=floor(m/w_length);
frameData=zeros(numFrames,w_length);
for k=1:numFrames
startAtIdx=(k-1)*w_length+1;
if k~=numFrames
frameData(k,:)=Y(startAtIdx+w_length-1);
else
frameData(k,1:m-startAtIdx+1)=Y(startAtIdx:end);
end
end
I am getting error in else part. The dimensions mismatch. So can any one help. I need to frame an audio signal and allocate memory for it.
Thanks in advance

回答(1 个)

Walter Roberson
Walter Roberson 2016-2-14
numFrames=floor(m/w_length); is wrong. Suppose your signal length is 160 and your frame length is 128 like you show, then floor(160/128) would be 1, but clearly there should be 2 frames.

类别

Help CenterFile Exchange 中查找有关 Simulation, Tuning, and Visualization 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by