view arrows/dsp/spec_bench.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents 672052bd81f8
children
line wrap: on
line source
% spec_bench - Arrow for doing spectral-based processing
%
% spec_bench ::
%    N:natural ~'frame size',
%    M:natural ~'hop size'
%    arrow( {[dftbins(N),W]}, {[dftbins(N),W]}, S1), ~'arrow to process magnitude spectra',
%    arrow( {[dftbins(N),W]}, {[dftbins(N),W]}, S2), ~'arrow to process phase spectra'
% -> arrow( {[N,W]}, {[N,W]}, spec_bench_state(S1,S2)) ~'total arrow'.
%
% This splits a signal into magnitude and phase spectra (using Hanning analysis window),
% applies supplied arrows to the two branches, and then recombines them using an inverse
% DFT and overlap-and-add to compose the output signal.

function o=spec_bench(N,M,a1,a2)
	H=spdiag(hanning(N,'periodic'));

	o=	(	amult(H)            ... % analysis window
		*	mag_phase_split(N)  ... % split into magnitude and phase spectra 
		*	(a1 + a2)           ... % apply a1 and a2 to mag and phase
		*	mag_phase_join(N)   ... % reconstruct
		*	amult((N/M/6)*H)        ... % reconstruction window
		*	aolapadd(N,M)       ... % overlap and add
		);
end