Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.49 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('Zana.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-1)));       %calculating Z-crossing%step -7-
  14. z = z / abs(max(z));
  15. STE = STE / abs(max(STE));
  16. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
  17. subplot(3,1,1);                      %ploting the 2 waves      %step -6-
  18. plot(Y);                             %
  19. xlabel('Time in Second');            %
  20. title('Speech Wave');                %
  21. grid on;                             %
  22. subplot(3,1,2);                      %
  23. plot(STE);                           %
  24. xlabel('Time in Second');            %
  25. title('Short Term Energy');          %
  26. grid on;                             %
  27. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
  28. subplot(3,1,3);                      %Ploting Z-crossing       %step -7-
  29. plot(z);                             %
  30. title('Zero Crossing Wave');         %
  31. grid on;                             %
  32. %~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement