How to multiply 2 fft's with different lengths?

6 Ansichten (letzte 30 Tage)
Talha Gungor
Talha Gungor am 26 Mai 2021
I want to find the output signal(y) from input signal(x) and impulse response(h). To do that first I take the fft of both x and h, then multply them, and finally taking the ifft of the result. The input signal is a 5 second sound. I tried to equalize the lengths of the FFTs but it didnt work. How can I overcome this?
[x,Fs]=audioread('hello.wav');
T=1/Fs;
L=220500;%length of the original sound
d=8820;%delay in terms of samples
a=0.8;%attenuation coefficient
h = [1 zeros(1,d-1) a];%impulse response h(n)
X=fft(x);
h1 =[h; zeros(length(x)-length(h),1)];
H=fft(h1);
Y=H.*X;
y=ifft(Y);

Antworten (1)

Paul Hoffrichter
Paul Hoffrichter am 27 Mai 2021
Is this your desired effect?
[x,Fs]=audioread('hello.wav');
sound(x,Fs);
T=1/Fs;
disp('Wait for music to complete')
pause( length(x)*T + 1);
L=length(x); % 220500;%length of the original sound
d=8820;%delay in terms of samples
a=0.8;%attenuation coefficient
h = [1 zeros(1,d-1) a];%impulse response h(n)
X=fft(x);
h1 =[h(:); zeros(length(x)-length(h),1)];
H=fft(h1);
Y=H.*X;
y=ifft(Y);
sound(y,Fs);

Kategorien

Mehr zu Measurements and Spatial Audio finden Sie in Help Center und File Exchange

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by