Advertisement
giganciprogramowania

l14 powtorzenie melodia

Apr 14th, 2023 (edited)
1,940
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. //star wars
  2. int[] melodia = { 440, 440, 440, 349, 523, 440, 349, 523, 440, 0, 659, 659, 659, 698, 523, 415, 349, 523, 440, 0, 880, 880, 440, 440, 880, 831, 784, 698, 740, 0, 622, 659, 415, 440, 523, 0, 440, 523, 440, 0 };
  3.  
  4. int[] czasTrwania = { 500, 500, 500, 350, 150, 500, 350, 150, 650, 500, 500, 500, 500, 350, 150, 500, 350, 150, 650, 500, 500, 500, 350, 150, 500, 350, 150, 650, 150, 500, 150, 500, 150, 1000, 500, 350, 150, 500, 350, 150, 650 };
  5.  
  6.  
  7. for (int i = 0; i < melodia.Length; i++)
  8. {
  9. if (melodia[i] != 0)
  10. {
  11. Console.Beep(melodia[i], czasTrwania[i]);
  12. }
  13. else
  14. {
  15. // pauza
  16. System.Threading.Thread.Sleep(czasTrwania[i]);
  17. }
  18. }
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26. //Mario Bros
  27. int[] melodia = { 659, 659, 0, 659, 0, 523, 659, 0, 784, 0, 392, 0, 523, 0, 392, 0, 330, 0, 440, 494, 0, 466, 0, 440, 0, 392, 659, 0, 784, 780, 0, 784, 0, 659, 0, 523, 587, 0, 494, 0, 523, 0, 392, 0, 330, 0, 440, 494, 0, 466, 0, 440, 0 };
  28.  
  29. int[] czasTrwania = { 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200, 200 };
  30.  
  31. for (int i = 0; i < melodia.Length; i++)
  32. {
  33. if (melodia[i] != 0)
  34. {
  35. Console.Beep(melodia[i], czasTrwania[i]);
  36. }
  37. else
  38. {
  39. // pauza
  40. System.Threading.Thread.Sleep(czasTrwania[i]);
  41. }
  42. }
  43.  
  44.  
  45.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement