Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- close all;
- clc;
- [y,Fs] = audioread('Thunderstruck.avr');
- Amostra10s = y(1:10*Fs);
- PlayMusic = audioplayer(Amostra10s, Fs);
- play(PlayMusic);
- normal = length(Amostra10s);
- aux = 0:normal-1;
- T = normal/Fs;
- freq = aux/T;
- fft_music = fftn(Amostra10s)/normal;
- fc = ceil(normal/2);
- fft_music = fft_music(1:fc);
- t = 0:0.1:295;
- figure();
- % Domínio do tempo
- subplot(2,1,1)
- hold on
- axis([0 441100])
- plot(Amostra10s,'r');
- xlabel('Tempo','FontSize',12);
- ylabel('Amplitude','FontSize',12);
- % Domínio da frequência
- subplot(2,1,2)
- hold on
- axis([0 1700])
- plot(freq(1:fc), abs(fft_music));
- xlabel('Freq.(Hz)', 'FontSize', 12);
- ylabel('Amplitude', 'FontSize', 12);
- print -dpng FFT2.png
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement