Advertisement
pabloducato

tunes

Dec 1st, 2018
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.80 KB | None | 0 0
  1. %load('chirp','Fs','y');
  2. %y=y/max(abs(y));t=(0:length(y)-1)/Fs;
  3. %sound(y*get(SD_VOLUME,'value'),Fs);
  4.  
  5. Fs = 8192;
  6. Vol = 0.8;
  7.  
  8. mnoznik_polton = 1.059463;
  9. C = 261.6;
  10. Cis = C*mnoznik_polton;
  11. D = 293.7;
  12. Dis = D*mnoznik_polton;
  13. E = 329.6;
  14. F = 349.6;
  15. Fis = F*mnoznik_polton;
  16. G = 391.9;
  17. Gis = G*mnoznik_polton;
  18. A = 440;
  19. B = A*mnoznik_polton;
  20. H = 493.9;
  21. C2 = 523.2;
  22. Fr =  [C Cis D Dis E F Fis G Gis A B H C];
  23. F = [C D E F G A H C2];
  24.  
  25. Czas = 1; %czas trwania pojedynczego dzwieku w sekundach
  26. t=0:1/Fs:Czas;
  27. for i = 1:length(F),
  28.     f = Fr(i);
  29.     disp(f);
  30.     y = sin(f*2*pi*t);
  31.     sound(y*Vol,Fs);
  32.     pause(Czas);
  33. end;
  34.  
  35. %t = (0:length(y)-1)/Fs;
  36. %y_ = [];
  37. %t_ = [];
  38. %for i=1:Czas,
  39. %    y_ = [y_ y];
  40. %    t_ = [t_ t];
  41. %end;
  42. %for f=140:100:540,
  43. %x=-pi:0.001:pi;
  44. %y = sin(x*f);
  45. %end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement