2
0

pllsp.m 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. % Copyright David Rowe 2010
  2. % This program is distributed under the terms of the GNU General Public License
  3. % Version 2
  4. %
  5. % Plots a bunch of information related to LSP quantisation:
  6. % - speech file
  7. % - LSPs before and after quantisation
  8. % - SNR for each frame
  9. %
  10. % Note: there is a 160 sample (two frame delay) from the when a sample
  11. % enters the input buffer until it is at the centre of the analysis window
  12. function pllsp(rawfile,
  13. dumpfile_prefix_lpc_only,
  14. dumpfile_prefix_lsp,
  15. start_f, end_f)
  16. fs=fopen(rawfile,"rb");
  17. s=fread(fs,Inf,"short");
  18. lpc_snr_name = strcat(dumpfile_prefix_lpc_only,"_lpc_snr.txt");
  19. lpc10_snr = load(lpc_snr_name);
  20. lpc_snr_name = strcat(dumpfile_prefix_lsp,"_lpc_snr.txt");
  21. lsp_snr = load(lpc_snr_name);
  22. lsp_name = strcat(dumpfile_prefix_lsp,"_lsp.txt");
  23. lsps = load(lsp_name);
  24. [m,n]=size(lsps);
  25. lsp = lsps(1:2:m,:);
  26. lsp_ = lsps(2:2:m,:);
  27. figure(1);
  28. clf;
  29. subplot(211);
  30. sp = s((start_f-2)*80:(end_f-2)*80);
  31. plot(sp);
  32. subplot(212);
  33. plot(lpc10_snr((start_f+1):end_f)-lsp_snr((start_f+1):end_f));
  34. figure(2);
  35. plot((4000/pi)*lsp((start_f+1):end_f,:));
  36. hold on;
  37. plot((4000/pi)*lsp_((start_f+1):end_f,:),'+-');
  38. hold off;
  39. endfunction