Advertisement
Guest User

Untitled

a guest
May 24th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.72 KB | None | 0 0
  1. clear all;
  2. close all;
  3. clc;
  4.  
  5. [y,Fs] = audioread('Thunderstruck.avr');
  6. Amostra10s = y(1:10*Fs);
  7. PlayMusic = audioplayer(Amostra10s, Fs);
  8. play(PlayMusic);
  9.  
  10. normal = length(Amostra10s);
  11. aux    = 0:normal-1;
  12. T      = normal/Fs;
  13. freq   = aux/T;
  14. fft_music = fftn(Amostra10s)/normal;
  15. fc = ceil(normal/2);
  16. fft_music = fft_music(1:fc);
  17.  
  18. t = 0:0.1:295;
  19.  
  20. figure();
  21. % Domínio do tempo
  22. subplot(2,1,1)
  23. hold on
  24. axis([0 441100])
  25. plot(Amostra10s,'r');
  26. xlabel('Tempo','FontSize',12);
  27. ylabel('Amplitude','FontSize',12);
  28.  
  29. % Domínio da frequência
  30. subplot(2,1,2)
  31. hold on
  32. axis([0 1700])
  33. plot(freq(1:fc), abs(fft_music));
  34. xlabel('Freq.(Hz)', 'FontSize', 12);
  35. ylabel('Amplitude', 'FontSize', 12);
  36.  
  37. print -dpng FFT2.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement