view Sirtassa/UpdateFilterCoefficientsOL.m @ 2:13ec2fa02a26 tip

(none)
author Yannick JACOB <y.jacob@se12.qmul.ac.uk>
date Tue, 03 Sep 2013 15:33:42 +0100
parents 2cd427e000b0
children
line wrap: on
line source
GEA = cell(nbInstrument,nbBandPassFilters);


xHat = sparse(zeros(HFFTS,len));

% Model Spectrogram
for ins = 1:nbInstrument
    for filterInd = 1:nbBandPassFilters
        GEA{ins,filterInd} = sparse(zeros(HFFTS, len));
        for frame = first:curFrame
            GEA{ins,filterInd}(:,frame-first+1) = (filterBasis(:,filterInd)*gains(ins,frame)).*(excitationSpectrums{ins,frame}*partialsWeights(:,ins));
        end
        xHat = xHat + GEA{ins,filterInd}*filterCoefficients(filterInd,ins);
    end
end

%Compute distance and r
distFilter(nbUpdates) = sum(sum( tmpMaskedSpectrogram .* log((tmpMaskedSpectrogram+eps) ./ (xHat+eps)) - tmpMaskedSpectrogram + xHat));
r = (currentMag+eps)./(xHat+eps);
updateFilterCoeff = ones(nbBandPassFilters,nbInstrument);

%Update Filter Coefficients
for ins = 1:nbInstrument
    for filterInd = 1:nbBandPassFilters
        updateFilterCoeff(filterInd,ins) = (sum(sum(GEA{ins,filterInd}.*r))+eps)/(sum(sum(GEA{ins,filterInd}))+eps);
    end
end
clear GEA;
filterCoefficients = filterCoefficients.*updateFilterCoeff;
for ins=1:nbInstrument
    maxValue = max(filterCoefficients(:,ins));
    filterCoefficients(:,ins) = filterCoefficients(:,ins) / maxValue;
    gains(ins,:) = gains(ins,:) * maxValue;
end
outlook = filterBasis * filterCoefficients;
%     figure, plot(outlook(1:blockSize/8,:));