Advertisement
plantbae

Código funcional 06/11/16

Nov 6th, 2016
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. clear all; clc; close all;
  2.  
  3. disp('Di "queso" en voz alta')
  4.  
  5. %Alarma para que el programa empiece a grabar
  6. bip= audioread('Sonido1.mp3');
  7. sound(bip, 44100);
  8. n = 0.5;
  9. pause(n);
  10.  
  11. % % Grabación de voz % %
  12. recObj = audiorecorder;
  13. recordblocking(recObj, 1.5);
  14. disp('Ok!');
  15. play(recObj);
  16. voz = getaudiodata(recObj);
  17. %disp(voz);
  18.  
  19. n = 1;
  20. pause(n);
  21.  
  22. bip= audioread('Sonido1.mp3');
  23. sound(bip, 44100);
  24.  
  25. n = 1;
  26. pause(n);
  27.  
  28. % % Grabación de test % %
  29. recObj2 = audiorecorder;
  30. recordblocking(recObj2, 1.5);
  31. disp('Ok!');
  32. play(recObj2);
  33. test= getaudiodata(recObj2);
  34.  
  35. % % Sumatoria de valores internos de los vectores % %
  36. %w = conv(voz, voz);
  37. %Sw = sum(w);
  38. v = conv(voz, test);
  39. Sv= sum(v);
  40. sumvoz= sum(voz);
  41. sumtest= sum(test);
  42.  
  43. % % Display de valores internos de los vectores % %
  44. disp('Esta es la sumatoria de los valores dentro de señal voz');
  45. disp(sumvoz);
  46. disp('Esta es la sumatoria de los valores dentro de señal test');
  47. disp(sumtest);
  48. disp('Esta es la sumatoria de los valores de convolución entre voz-test');
  49. disp(Sv);
  50.  
  51. % % Display Divisiones % %
  52. disp('Esta es la división convvoz-test/sumtest');
  53. difss = Sv/sumtest;
  54. disp(difss);
  55.  
  56.  
  57.  
  58.  
  59. % % Escuchar convolución % %
  60. %bip= audioread('Sonido2.mp3');
  61. %sound(bip, 44100);
  62. %n = 5;
  63. %pause(n);
  64. %play(w);
  65.  
  66.  
  67. % %Graficar Funciones%%
  68. subplot(4,1,1);
  69. plot(voz);
  70. title('Voz');
  71. xlabel('Tiempo(s)');
  72. ylabel('Amplitud');
  73.  
  74. subplot(4,1,2);
  75. plot(test);
  76. title('Test');
  77. xlabel('Tiempo(s)');
  78. ylabel('Amplitud');
  79.  
  80. subplot(4,1,3);
  81. plot(w);
  82. title('Misma Señal');
  83. xlabel('Tiempo(s)');
  84. ylabel('Amplitud');
  85.  
  86. subplot(4,1,4);
  87. plot(v);
  88. title('Diferentes Señales');
  89. xlabel('Tiempo(s)');
  90. ylabel('Amplitud');
  91.  
  92.  
  93.  
  94. %Alinear: https://www.mathworks.com/help/signal/ref/xcorr.html
  95. %Conv Sum: https://www.youtube.com/watch?v=9EUHs-pArJg
  96.  
  97. % % % x = 0 : 0.1 : 12000;
  98. % % % y = double(x == 0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement