Guest User

Untitled

a guest
Oct 21st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. [y,fs] = audioread('melody.wav')
  2. Y = fft(y);
  3. plot(abs(Y))
  4. figure
  5. N = fs % number of FFT points
  6. transform = fft(y,N)/N;
  7. magTransform = abs(transform);
  8.  
  9. faxis = linspace(-fs/2,fs/2,N);
  10. plot(faxis,fftshift(magTransform));
  11. xlabel('Frequency (Hz)')
  12.  
  13. % view frequency content up to half the sampling rate:
  14. %axis([0 length(faxis)/2, 0 max(magTransform)])
  15.  
  16. % change the tick labels of the graph from scientific notation to floating point:
  17. xt = get(gca,'XTick');
  18. set(gca,'XTickLabel', sprintf('%.0f|',xt))
Add Comment
Please, Sign In to add comment