Mercurial > hg > ishara
view dsp/mag_phase_split.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | c3b0cd708782 |
children |
line wrap: on
line source
function o=mag_phase_split(N) % mag_phase_split - arrow to get FFT and do mag/phase split % % mag_phase_split :: % N:natural ~'frame size' % -> arrow( {[[N,L]]}, {[[M,L]], [[M,L]]},empty) :- M=dftbins(N). bins=1+floor(N/2); singles=1:ceil(N/2):bins; o=arr(@mps); function [S,P]=mps(X) Y=fft(X,N); Z=Y(1:bins,:); M=abs(Z); P=Z./M; % get complex phases of components. S=M*sqrt(2/N); % sqrt of double of total power per band S(singles,:)=S(singles,:)/sqrt(2); % undo double counting of singletons end end