ivan@161: function reconstructed=AudioDenoise_reconstruct(y, Problem) ivan@161: %% Audio denoising Problem reconstruction function ivan@161: % ivan@161: % This reconstruction function is using sparse representation y ivan@161: % in dictionary Problem.A to reconstruct denoised audio. ivan@161: % The output structre has following fields: ivan@161: % audio - denoised audio signal ivan@161: % psnr - psnr of the reconstructed audio signal ivan@161: % ivan@161: % [1] I. Damnjanovic, M. E. P. Davies, and M. P. Plumbley "SMALLbox - an ivan@161: % evaluation framework for sparse representations and dictionary ivan@161: % learning algorithms," V. Vigneron et al. (Eds.): LVA/ICA 2010, ivan@161: % Springer-Verlag, Berlin, Germany, LNCS 6365, pp. 418-425 ivan@161: ivan@161: % ivan@161: % Centre for Digital Music, Queen Mary, University of London. ivan@161: % This file copyright 2011 Ivan Damnjanovic. ivan@161: % ivan@161: % This program is free software; you can redistribute it and/or ivan@161: % modify it under the terms of the GNU General Public License as ivan@161: % published by the Free Software Foundation; either version 2 of the ivan@161: % License, or (at your option) any later version. See the file ivan@161: % COPYING included with this distribution for more information. ivan@161: %% ivan@161: ivan@161: windowSize = Problem.windowSize; ivan@161: overlap = Problem.overlap; ivan@161: ws = Problem.ws(windowSize); ivan@161: wa = Problem.wa(windowSize); ivan@161: ivan@161: A = Problem.A; ivan@161: ivan@161: orig = Problem.Original; ivan@161: noisy = Problem.Noisy; ivan@161: ivan@161: ivan@161: % reconstruct audio frames ivan@161: ivan@161: xFrames = diag(ws)*(A*y); ivan@161: wNormFrames = (ws.*wa)'*ones(1,size(xFrames,2)); ivan@161: ivan@161: % overlap and add ivan@161: ivan@161: rec = col2imstep(xFrames, size(noisy), [windowSize 1], [windowSize*overlap 1]); ivan@161: wNorm = col2imstep(wNormFrames, size(noisy), [windowSize 1], [windowSize*overlap 1]); ivan@161: wNorm(find(wNorm==0)) = 1; ivan@161: recN = rec./wNorm; ivan@161: ivan@161: %% output structure image+psnr %% ivan@161: reconstructed.audio = recN; ivan@161: reconstructed.psnr = 20*log10(sqrt(numel(orig)) / norm(orig - reconstructed.audio)); ivan@161: ivan@161: end