Filter löschen
Filter löschen

Ifft of an audio .wav signal

13 Ansichten (letzte 30 Tage)
Khalid Mwambakale
Khalid Mwambakale am 23 Mai 2022
Beantwortet: Mann Baidi am 26 Feb. 2024
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');

Antworten (1)

Mann Baidi
Mann Baidi am 26 Feb. 2024
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!

Kategorien

Mehr zu Audio I/O and Waveform Generation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by