Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.33 KB | None | 0 0
  1. %Zana Sulaiman MohammedAli Simo--ECE Grade 2
  2. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
  3. clear all;                           %clearing all data from
  4. clc;                                 %Workspace
  5. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
  6. [Y,Fs]=audioread('ZanaSulaiman.Wav');%reading the audio file   %step -3-
  7. Y=Y(:,1);                            %Framaing the signal wave %step -4-
  8. L=0.03*Fs;                           %
  9. R=0.005*Fs;                          %
  10. X=buffer(Y,L,R);                     %making the buffer        %step -5-
  11. m=length(Y);                         %
  12. STE=sum(X.^2);                       %calculating Energy       %step -6-
  13. z=sum(abs(sign(X))-sign(X(m-1)));    %calculating Z-crossing   %step -7-
  14. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
  15. subplot(3,1,1);                      %ploting the 2 waves      %step -6-
  16. plot(Y);                             %
  17. xlabel('Time in Second');            %
  18. title('Speech Wave');                %
  19. subplot(3,1,2);                      %
  20. plot(STE);                           %
  21. xlabel('Time in Second');            %
  22. title('Shor Term Energy');           %
  23. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
  24. subplot(3,1,3);                      %Ploting Z-crossing       %step -7-
  25. plot(z);                             %
  26. title('Zero Crossing Wave');         %
  27. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement