필터 지우기
필터 지우기

Ifft of an audio .wav signal

조회 수: 1 (최근 30일)
Khalid Mwambakale
Khalid Mwambakale 2022년 5월 23일
답변: Mann Baidi 2024년 2월 26일
Hi everyone.
I have never used matlab before so forgive my poor use of jargon etc.
I am trying to get IFFT graphs (with magnitude and phase ploted seperatley) of some audio files (reference file, and impaired signals).
I have found code (below) which gives this, but it is of an 'input signal'. I am unsure how to perform this for an existing .wav file. I've tried adding 'audio read...' however this gives me an error message "Error using stem (line 43)
The length of X must match the number of rows of Y."
Any help would be hugely appreciated, thanks in advance.
%IFFT
close all; clear all; clc;
[sig1, fs] = audioread('Books-Norm_01.wav'); % import the song
x=input('Books-Norm_01.wav');
n=input('Books-Norm_01.wav');
subplot(3,1,1); stem(x); xlabel('time'); ylabel ('amplitude');
title('Books-Norm_01.wav');
xk=ifft(x,n);
magxk=abs(xk);
anglexk=angle(xk); k=0:1:n-1;
subplot(3,1,2); stem(k,magxk); xlabel('time'); ylabel('amplitude');
title('mag plot');
subplot(3,1,3); stem(k,anglexk); xlabel('time'); ylabel('amplitude');
title('phase plot');

답변 (1개)

Mann Baidi
Mann Baidi 2024년 2월 26일
Hi Khalid,
As per the information given in the question above, I understand that you would like to get the IFFT graphs for your existing audio file (.wav format) using the code given provided in the question.
But unfortunately, you are facing issue while running the code.
For using the code for plooting the IFFT graphs, you will have to remove the input lines in the code and replace the "x" and "n" variables with the "sig1" and "fs" variables respectively. By doing this you can run your code without any errors. You can use the below modified code.
%IFFT
close all; clear all; clc;
[sig1, fs] = audioread('Books-Norm_01.wav'); % import the song
subplot(3,1,1); stem(sig1); xlabel('time'); ylabel ('amplitude');
title('Books-Norm_01.wav');
xk=ifft(sig1,fs);
magxk=abs(xk);
anglexk=angle(xk); k=0:1:fs-1;
subplot(3,1,2); stem(k,magxk); xlabel('time'); ylabel('amplitude');
title('mag plot');
subplot(3,1,3); stem(k,anglexk); xlabel('time'); ylabel('amplitude');
title('phase plot');
Hoping this would help!

카테고리

Help CenterFile Exchange에서 Audio I/O and Waveform Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by