Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. %LPC vocoder
  2.  
  3.  
  4. s = loadbin('frame_unvoiced.bin');
  5. s2 = loadbin('frame_voiced.bin');
  6. fs = 16000;
  7. p = 16;
  8. N = length(s);
  9.  
  10.  
  11. [a,E] = lpc(s,p);
  12.  
  13. exc = randn(N,1);
  14.  
  15. out = filter(sqrt(E),a,exc);
  16.  
  17. x = abs(fft(out));
  18.  
  19. figure(1)
  20. subplot(211)
  21. plot(s,'b')
  22. hold on
  23. plot(out,'r')
  24. hold off
  25. subplot(212)
  26. y = abs(fft(s));
  27. plot(y,'b')
  28. hold on
  29. plot(x,'r')
  30. hold off
  31.  
  32. %%%%%%%%%%%%%%%%%%%% For voiced signal
  33.  
  34. fs = 16000;
  35. p = 16;
  36. N = length(s2);
  37. L0 = 130;
  38.  
  39. [a,E] = arburg(s2,p);
  40.  
  41. exc2 = randn(N,1);
  42.  
  43. exc2 = zeros(N,1);
  44.  
  45. exc2(1:L0-1:end) = 1;
  46.  
  47. Pexc = mean(exc2.^2);
  48.  
  49. exc2 = exc2./sqrt(Pexc);
  50.  
  51. out2 = filter(sqrt(E),a,exc2);
  52.  
  53. x2 = abs(fft(out2));
  54.  
  55. figure(2)
  56. subplot(211)
  57. plot(s2,'b')
  58. hold on
  59. plot(out2,'r')
  60. hold off
  61. subplot(212)
  62. y2 = abs(fft(s2));
  63. plot(y2,'b')
  64. hold on
  65. plot(x2,'r')
  66. hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement