Facing error in generalizing hamming window.

1 次查看(过去 30 天)
%Reading the audio
y=audioread('speech.wav');
%sound(y);
subplot(2,3,1);
plot(y);
xlabel('Samples');
ylabel('Magnitude');
title('Original speech signal');
%Adding noise
x=awgn(y,5);
z=y+x;
z=z / max(abs(z));
%sound(z);
subplot(2,3,2);
plot(z);
xlabel('Samples');
ylabel('Magnitude');
title('Noise added to speech signal');
% Framing
f_duration = 0.025;
fs=8000;
f_size = (f_duration.*fs);
n = length(y);
n_f = floor(n/f_size); %no. of frames
temp = 0;
for i = 1 : n_f
frames(i,:) = z(temp + 1 : temp + f_size);
window=hamming(200);
window_framing(i,:)=frames(i,:).*window;
temp = temp + f_size;
end
I am trying to generalize the code for hamming windowing for every frame. But it is giving me "Unable to perform assignment because the indices on the left side are not compatible with the size of the right side." this error. Please resolve my query.

回答(0 个)

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by