C   43

array-notes.c

Guest on 15th January 2022 09:21:24 AM

  1. /* * * * *
  2.  * array-notes.c
  3.  *
  4.  * Notes for a song.
  5.  *
  6.  * Authors: Dilan Ustek, Erik Opavsky
  7.  *
  8.  *
  9.  */
  10.  
  11. #include "MyroC.h"
  12.  
  13.  
  14. // Musical notes in the scale, as they correspond to beep frequency
  15.  
  16. #define PITCHA4 440.0
  17. #define PITCHBf4 466.164
  18. #define PITCHAs4 466.164
  19. #define PITCHB4  493.883
  20. #define PITCHC5  523.251
  21. #define PITCHDf5 554.37
  22. #define PITCHCs5 554.37
  23. #define PITCHD5  587.33
  24. #define PITCHEf5 622.25
  25. #define PITCHDs5 622.25
  26. #define PITCHE5  659.26
  27. #define PITCHF5  698.46
  28. #define PITCHGf5 739.99
  29. #define PITCHFs5 739.99
  30. #define PITCHG5  783.99
  31. #define PITCHAf5 830.61
  32. #define PITCHGs5 830.61
  33. #define PITCHA5  880
  34. #define PITCHBf5 932.33
  35. #define PITCHAs5 932.33
  36. #define PITCHB5  987.77
  37.  
  38.  
  39. int
  40. main()
  41. {
  42.   rConnect("/dev/rfcomm0");
  43.  
  44.   /* notes for the song */
  45.   double notes[] = { PITCHD5,
  46.                     PITCHD5,
  47.                     PITCHA5,
  48.                     PITCHA5,
  49.                     PITCHB5,
  50.                     PITCHB5,
  51.                     PITCHA5,
  52.                     PITCHA5,
  53.                     PITCHG5,
  54.                     PITCHG5,
  55.                     PITCHFs5,
  56.                     PITCHFs5,
  57.                     PITCHE5,
  58.                     PITCHE5,
  59.                     PITCHD5 };
  60.  
  61.   /* Now beep each of the notes for 0.5 seconds. */
  62.         /* --- Your Code Here --- */
  63.  
  64.  
  65.   rDisconnect();
  66.  
  67.   return 0;
  68. } // main

Raw Paste


Login or Register to edit or fork this paste. It's free.