Advertisement
makispaiktis

PSES_8_2

Nov 6th, 2020 (edited)
2,066
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.09 KB | None | 0 0
  1. clear all
  2. clc
  3.  
  4. s = audiorecorder(8000, 16, 1);
  5. display('Say a = "AAAAAAAA"');
  6. recordblocking(s, 3);
  7. aaaa = getaudiodata(s);
  8. plot(aaaa);
  9. title("Signals in the time");
  10. hold on
  11. display('"AAAAAAAA" has been recorded!')
  12.  
  13. sum = 0;
  14. for i = 1 : 4 * 10^9
  15.     sum = sum + 1;
  16. end
  17.  
  18. display('SAY i = "IIIIIIII"');
  19. recordblocking(s, 3);
  20. iiii = getaudiodata(s);
  21. plot(iiii);
  22. display('"IIIIIIII" has been recorded!')
  23.  
  24. A = fft(aaaa);
  25. mA = abs(A);
  26. pA = angle(A);
  27. I = fft(iiii);
  28. mI = abs(I);
  29. pI = angle(I);
  30. figure(2);
  31. plot(mA);
  32. title("Signals in Fourier domain");
  33. hold on
  34. plot(mI);
  35.  
  36. W1 = mA .* exp(j*pI);
  37. W2 = mI .* exp(j*pA);
  38. w1 = real(ifft(W1));
  39. w2 = real(ifft(W2));
  40. s1 = audioplayer(w1, 8000);
  41. display('You will listen to w1 = IFT{ |A|<I }');
  42. play(s1);
  43.  
  44. sum = 0;
  45. for i = 1 : 4 * 10^9
  46.     sum = sum + 1;
  47. end
  48.  
  49. s2 = audioplayer(w2, 8000);
  50. display('You will listen to w2 = IFT{ |I|<A }');
  51. play(s2);
  52. display(' ');
  53. display('If you made a = "AAAAAAAA" and i = "IIIIIIII", you must hear:');
  54. display('The first sound = w1 as "AAAAAAAA" and');
  55. display('The second sound = w2 as "IIIIIIII"');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement