I’d like to digitally signal process an audio data. Therefore my idea was to:
- Split the audio data into individual blocks of 16 samples each.
- Each block has an overlap of 50% (8 samples are shared across each consecutive block).
- Each block of data is multiplied with a window (hanning),
- Do the FFT,
- apply an Equalizer to the FFT data (Which I will implement later),
- iFFT the data and recover the original signal back.
Due to the Equalizer, the output might differ a little from the input, but shouldn’t be distorted .
To this end, I implemented a MATLAB code,
% I am using an audio file sampled at 16kHz [Input_sig_16k,Fs] = audioread(‘filename); window_size = 16; % individual block size overlap_win = 8; % 50% overlap data_full = zeros(1,length(Input_sig)); w = hanning(16); % hanning windowing for ii = 1:(length(Input_sig)/win_size)-1 data_range = ((ii-1)*overlap_win)+1:((ii-1)*overlap_win)+16; % [data_range(1) data_range(end)] data_block = Input_sig_16k(data_range); % windowing function data_block = data_block.*w; % plot(data_block,'-rx'); % ii fft_sig = fft(data_block); %FFT of the signal % I will multiply the frequency data with an Equalizer ifft_sig = ifft(fft_sig); %iFFT of the signal data_full(((ii-1)*window_size)+1:((ii-1)*window_size)+16) = ifft_sig; end subplot(2,1,1), plot(Input_sig_16k,'-og'), grid on; % plot and compare both the signals subplot(2,1,2), plot(data_full,'-xr'), grid on;
However the output data is quite distorted. I’m not sure what I need to do to recover the original signal. Could someone let me know the mistake behind what I have done.
So how do I obtain the correct output?