Mercurial > hg > ishara
annotate dsp/formants.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | c3b0cd708782 |
children |
rev | line source |
---|---|
samer@32 | 1 % formants - Compute formants from LPC coefficients |
samer@32 | 2 function F=formants(a,M,fs) |
samer@32 | 3 |
samer@32 | 4 const=fs/(2*pi); |
samer@32 | 5 if all(isfinite(a)) |
samer@32 | 6 rts=roots(a); |
samer@32 | 7 |
samer@32 | 8 fx = const*angle(rts); |
samer@32 | 9 bw = -2*const*log(abs(rts)); |
samer@32 | 10 |
samer@32 | 11 F = log(sort(fx(fx>90 & fx<4000 & bw<700))); |
samer@32 | 12 N = length(F); |
samer@32 | 13 if N<M, F=[F;nan(M-N,1)]; |
samer@32 | 14 else F=F(1:M); end |
samer@32 | 15 else |
samer@32 | 16 F=nan(M,1); |
samer@32 | 17 end |
samer@32 | 18 % only first 3? |