I have a 0,25 seconds audio file in wav
format where i want to delete some frequencies.
1) First I make a FFT to get the spectrum
2) Then i put in some Frequency I want to delete and a tolerance
3) When I've deleted the Frequency i make a IFFT to get the origin signal without the deleted frequency
I'm little bit confused from my result i got after the IFFT. I've deleted all frequency above 400Hz and in my IFFT x(t) are higher frequency than that?
Did i something wrong in the the shifting from the FFT because its symmetric?
https://imggmi.com/full/2019/7/16/4febff13474871261e8c77c2d5e3f63b-full.jpg.html https://cdn1.imggmi.com/uploads/2019/7/16/11687331ba65166480a2ae3d794e4aa1-full.jpg
Many thanks in advance for help!! BR Mathias
clear all;
close all;
%Wav File einlesen und die Daten in data und Abtastrate in Fs
[data,Fs]=audioread('Mono_120A_v20_02sec.wav');
%Ermittlung der Arraygröße
[nSamples,nChannels]=size(data);
%Länge der Audiodatei ermitteln
waveFileLength=nSamples/Fs;
t=[0:length(data)-1] / Fs;
%Signal darstellen
subplot(3,2,1)
plot(t,data)
title('Audio')
xlabel('Zeit')
ylabel('X(t)')
%FFT des Signal
y_fft = abs(fft(data)); %Retain Magnitude
y_fft = y_fft(1:nSamples/2); %Discard Half of Points
f = Fs*(0:nSamples/2-1)/nSamples; %Prepare freq data for plot
%Plot Sound File in Frequency Domain
subplot(3,2,2)
plot(f, y_fft)
grid on
xlim([0 20000])
% ylim([0 200])
xlabel('Frequency (Hz)')
ylabel('Amplitude')
title('Freqenzbereich 70A')
yy=fft(data);
yyy=fftshift(yy);
f=Fs.*(-nSamples/2:nSamples/2-1)/nSamples;
subplot(3,2,3)
plot(f,(yyy.*conj(yyy)/(nSamples*nSamples)));
title('FFT')
%%%%%%%%%%%%%%%%%%%
Fdelete = 15000; % Diese Frequenz soll gelöscht werden
tolerance = 14600; % Toleranz um die Frequenz
idx_p = find(f>Fdelete-tolerance & f<Fdelete+tolerance); % Löschen der Frequenzen
idx_n = find(f>(Fs-Fdelete)-tolerance & f<(Fs-Fdelete));
idx = [idx_p idx_n];
yyy(idx) = 0;
Fdelete = -15000;
tol = 14600; % Toleranz um die Frequenz
idx_p = find(f>Fdelete-tolerance & f<Fdelete+tolerance); % Löschen der Frequenzen
idx_n = find(f>(Fs-Fdelete)-tolerance & f<(Fs-Fdelete));
idx = [idx_p idx_n];
yyy(idx) = 0;
subplot(3, 2, 4)
% plot(f, yyy); title('After');
plot(f,(yyy.*conj(yyy)/(nSamples*nSamples)));
title('After')
%%%%%%%%%%%%%%%%%%%
subplot(3, 2, 6)
plot(t,data)
title('origin x(t)')
xlabel('Zeit')
ylabel('X(t)')
%%%%%%%%%%%%%%%%%%%
subplot(3, 2, 5)
y1=ifft(yyy,'symmetric');
plot(t,y1),grid on;
title('IFFT x(t)')