2
0

lpcpf.m 769 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. % lpcpf.m
  2. % David Rowe Aug 27 2012
  3. % Experiments with LPC post filtering
  4. function lpcpf(ak_filename, f)
  5. aks = load(ak_filename);
  6. ak = aks(f,:);
  7. [tmp p] = size(ak);
  8. p -= 1;
  9. A = freqz(1,ak, 4000);
  10. AdB = 20*log10(abs(A));
  11. gamma = 0.5;
  12. gammas = gamma .^ (0:p);
  13. W = freqz(ak .* gammas,1, 4000);
  14. WdB = 20*log10(abs(W));
  15. beta = 0.2;
  16. R = abs(freqz(ak .* gammas, ak, 4000));
  17. %P = (R/max(R)) .^ beta;
  18. P = R .^ beta;
  19. AP = abs(A) .* P;
  20. eA = sum(abs(A) .^ 2);
  21. eAP = sum(AP .^ 2);
  22. gain = sqrt(eA/eAP)
  23. AP *= gain;
  24. PdB = 20*log10(P);
  25. APdB = 20*log10(AP);
  26. 10*log10(sum(AP .^ 2))/10*log10(sum(abs(A) .^ 2))
  27. figure(1);
  28. clf;
  29. plot(AdB);
  30. hold on;
  31. plot(WdB,'g');
  32. plot(PdB,'r');
  33. plot(APdB,'b.');
  34. hold off;
  35. endfunction