Borrar filtros
Borrar filtros

Ifft of an audio .wav signal

4 visualizaciones (últimos 30 días)
Khalid Mwambakale
Khalid Mwambakale el 23 de Mayo de 2022
Respondida: Mann Baidi el 26 de Feb. de 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');

Respuestas (1)

Mann Baidi
Mann Baidi el 26 de Feb. de 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!

Categorías

Más información sobre Audio I/O and Waveform Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by