%\| Summer Semester 2014
%\| AudioLabs Lab Course
%===============================
%\| MODULE: Speech enhancement 
%\| Prof. Dr.-Ing Emanuel Habets
%\| Module supervsors: 
%\|     - Soumitro Chakrabarty
%\|     - Maja Taseska
%===============================
%\| Author:
%\|     - Maja Taseska
%===============================
%===============================

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%=============FUNCTION DESCRIPTION====================

% Input parameters
%-----------------
%\| "spectrum" ... a matrix  [num_mics x num_frequencies x num_frames]
%containing the STFT coefficients of the signals at the microphones
%\| "mask" a matrix [num_frequencies x num_frames] indicating at which
%time-frequency points the source of interest is dominant (at which
%time-frequency points we should make an update)
%\| "alpha" is a constant scalar averaging parameter

% Output parameters
%-------------------
%\| "allPSDs" ... 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function allPSDs = fcn_recursive_PSD_estimation(spectrum,mask,alpha)

% Memory allocation
num_freq = size(spectrum,2);
num_frames = size(spectrum,3);
num_mics = size(spectrum,1);
allPSDs = zeros(num_mics,num_mics,num_freq,num_frames);
% initialization
tmpPSD = (10^(-4))*rand(num_mics,num_mics,num_freq);


for frameidx = 1:num_frames 
    for freqidx = 1:num_freq
        
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        % FILL IN THE BLANKS
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        
        % select the signal for the current time-frequency bin
        currentSig = spectrum(:,freqidx,frameidx);
        
        % compute the average parameter based on the mask
        currentAlpha = 
               
        % Perform the recursive step for the current TF-bin
        tmpPSD(:,:,freqidx) = 
        
        
    end
    
    % Store the PSDs for the current time frame
    allPSDs(:,:,:,frameidx) = tmpPSD;
    %_______________________________________________
end
