Advertisement
makispaiktis

PSES_8

Nov 6th, 2020 (edited)
1,960
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.85 KB | None | 0 0
  1. % 1o orisma = syxnothta deigmatolhpsias >= 40kHz (fwni ws ta 20kHz),
  2. % usually 44kHz px mp3
  3. % H fwni paei synithws ws 5kHz, mporw sta 10kHz
  4. % O OTE kratage 3.5kHz ---> epilegw 8kHz
  5. % 16 deigmata apo to kanali 1
  6.  
  7. s = audiorecorder(8000, 16, 1);
  8. recordblocking(s, 5);   % Deyterolepta
  9. play(s);
  10. f1 = getaudiodata(s);
  11. plot(f1);
  12. F1 = fft(f1);
  13.  
  14. recordblocking(s, 5);
  15. f2 = getaudiodata(s);
  16. play(s);
  17. plot(f2);
  18. F2 = fft(f2);
  19. mF1 = abs(F1);
  20. pF1 = angle(F1);
  21. mF2 = abs(F2);
  22. pF2 = angle(F2);
  23.  
  24. Z1 = mF1 .* exp(j*pF2);
  25. Z2 = mF2 .* exp(j*pF1);
  26. z1 = ifft(Z1);              % Ta bgazei complex, prepei real (to imaginary taxis 10^(-17))
  27. z2 = ifft(Z2);
  28. % plot(real(z1));
  29. % plot(imag(z1));
  30. % plot(real(z2));
  31. % plot(real(z2));
  32. z1 = real(z1);
  33. z2 = real(z2);
  34.  
  35. % Thelw na akousw z1, z2
  36. s = audioplayer(z1, 8000);
  37. play(s);
  38. s = aydioplayer(z2, 8000);
  39. play(s);s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement