Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 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 = 150;
  38.  
  39. [a,E] = lpc(s2,p);
  40.  
  41. exc2 = randn(N,1);
  42.  
  43. out2 = filter(sqrt(E),a,exc2);
  44.  
  45. x2 = abs(fft(out2));
  46.  
  47. figure(2)
  48. subplot(211)
  49. plot(s2,'b')
  50. hold on
  51. plot(out2,'r')
  52. hold off
  53. subplot(212)
  54. y2 = abs(fft(s2));
  55. plot(y2,'b')
  56. hold on
  57. plot(x2,'r')
  58. hold off
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement