Posted By

A4i on 01/20/12


Tagged

song jingle Bells


Versions (?)

Jingle Bells Song


 / Published in: C
 

Jingle Bells Song in C

  1. // 19-1-2012 by A4i...
  2.  
  3. #include <stdio.h>
  4. #include <windows.h>
  5.  
  6. #define C3 130
  7. #define Db3 138
  8. #define D3 146
  9. #define Eb3 155
  10. #define E3 164
  11. #define F3 174
  12. #define Gb3 185
  13. #define G3 196
  14. #define Ab3 207
  15. #define A3 220
  16. #define Bb3 233
  17. #define B3 246
  18.  
  19. #define C4 261
  20. #define Db4 277
  21. #define D4 293
  22. #define Eb4 311
  23. #define E4 329
  24. #define F4 349
  25. #define Gb4 369
  26. #define G4 392
  27. #define Ab4 415
  28. #define A4 440
  29. #define Bb4 466
  30. #define B4 493
  31.  
  32. #define C5 523
  33. #define Db5 544
  34. #define D5 587
  35. #define Eb5 622
  36. #define E5 659
  37. #define F5 698
  38. #define Gb5 739
  39. #define G5 783
  40. #define Ab5 830
  41. #define A5 880
  42. #define Bb5 932
  43. #define B5 987
  44.  
  45. #define C6 1046
  46. #define Db6 1108
  47. #define D6 1174
  48. #define Eb6 1244
  49. #define E6 1318
  50. #define F6 1396
  51. #define Gb6 1479
  52. #define G6 1567
  53. #define Ab6 1661
  54. #define A6 1760
  55. #define Bb6 1864
  56. #define B6 1975
  57.  
  58. #define C7 2093
  59. #define Db7 2217
  60. #define D7 2349
  61. #define Eb7 2489
  62. #define E7 2637
  63. #define F7 2794
  64. #define Gb7 2960
  65. #define G7 3136
  66. #define Ab7 3322
  67. #define A7 3520
  68. #define Bb7 3729
  69. #define B7 3951
  70.  
  71. #define full 600
  72. #define half full / 2
  73.  
  74. // ---------------------------------------------------------------------- Melody
  75.  
  76. void refrenSolo()
  77. {
  78. Beep(E5, half);
  79. Beep(E5, half);
  80. Beep(E5, half);
  81.  
  82. Sleep(half);
  83.  
  84. Beep(E5, half);
  85. Beep(E5, half);
  86. Beep(E5, half);
  87.  
  88. Sleep(half);
  89.  
  90. Beep(E5, half);
  91. Beep(G5, half);
  92. Beep(C5, half);
  93. Beep(D5, half);
  94. Beep(E5, half);
  95.  
  96. Beep(C4, half);
  97. Beep(D4, half);
  98. Beep(E4, half);
  99.  
  100. Beep(F5, half);
  101. Beep(F5, half);
  102. Beep(F5, half);
  103.  
  104. Sleep(half);
  105.  
  106. Beep(F5, half);
  107. Beep(E5, half);
  108. Beep(E5, half);
  109.  
  110. Sleep(half);
  111.  
  112. Beep(E5, half);
  113. Beep(D5, half);
  114. Beep(D5, half);
  115. Beep(E5, half);
  116. Beep(D5, half);
  117.  
  118. Sleep(half);
  119.  
  120. Beep(G5, half);
  121.  
  122. Sleep(half);
  123.  
  124. // -----------
  125.  
  126. Beep(E5, half);
  127. Beep(E5, half);
  128. Beep(E5, half);
  129.  
  130. Sleep(half);
  131.  
  132. Beep(E5, half);
  133. Beep(E5, half);
  134. Beep(E5, half);
  135.  
  136. Sleep(half);
  137.  
  138. Beep(E5, half);
  139. Beep(G5, half);
  140. Beep(C5, half);
  141. Beep(D5, half);
  142. Beep(E5, half);
  143.  
  144. Beep(C4, half);
  145. Beep(D4, half);
  146. Beep(E4, half);
  147.  
  148. Beep(F5, half);
  149. Beep(F5, half);
  150. Beep(F5, half);
  151.  
  152. Sleep(half);
  153.  
  154. Beep(F5, half);
  155. Beep(E5, half);
  156. Beep(E5, half);
  157.  
  158. Sleep(half);
  159.  
  160. Beep(G5, half);
  161. Beep(G5, half);
  162. Beep(F5, half);
  163. Beep(D5, half);
  164. Beep(C5, full);
  165.  
  166. Sleep(full);
  167. }
  168.  
  169. void coupleSolo()
  170. {
  171. Beep(G4, half);
  172. Beep(E5, half);
  173. Beep(D5, half);
  174. Beep(C5, half);
  175. Beep(G4, full);
  176.  
  177. Sleep(half * 2);
  178.  
  179. Beep(G4, half);
  180. Beep(E5, half);
  181. Beep(D5, half);
  182. Beep(C5, half);
  183. Beep(A4, full);
  184.  
  185. Sleep(full);
  186.  
  187. Beep(A4, half);
  188. Beep(F5, half);
  189. Beep(E5, half);
  190. Beep(D5, half);
  191. Beep(G5, full);
  192.  
  193. Sleep(full);
  194.  
  195. Beep(A5, half);
  196. Beep(A5, half);
  197. Beep(G5, half);
  198. Beep(Eb5, half);
  199. Beep(E5, full);
  200.  
  201. Sleep(full);
  202.  
  203. // -----------
  204.  
  205. Beep(G4, half);
  206. Beep(E5, half);
  207. Beep(D5, half);
  208. Beep(C5, half);
  209. Beep(G4, full);
  210.  
  211. Sleep(full);
  212.  
  213. Beep(G4, half);
  214. Beep(E5, half);
  215. Beep(D5, half);
  216. Beep(C5, half);
  217. Beep(A4, full);
  218.  
  219. Sleep(full);
  220.  
  221. Beep(A4, half);
  222. Beep(F5, half);
  223. Beep(E5, half);
  224. Beep(D5, half);
  225. Beep(G5, full);
  226.  
  227. Sleep(full);
  228.  
  229. Beep(A5, half);
  230. Beep(G5, half);
  231. Beep(F5, half);
  232. Beep(D5, half);
  233. Beep(C5, full);
  234.  
  235. Sleep(full);
  236. }
  237.  
  238. // ------------------------------------------------------------------- Bass Line
  239.  
  240. void refrenBass()
  241. {
  242. Beep(C4, full);
  243. Beep(G3, full);
  244. Beep(C4, full);
  245. Beep(G3, full);
  246. Beep(C4, full);
  247. Beep(G3, full);
  248. Beep(C4, half);
  249.  
  250. Beep(C3, half);
  251. Beep(D3, half);
  252. Beep(E3, half);
  253.  
  254. Beep(F4, full);
  255. Beep(C4, full);
  256. Beep(C4, full);
  257. Beep(G3, full);
  258. Beep(G3, full);
  259. Beep(D3, full);
  260. Beep(G3, full);
  261. Beep(G4, full);
  262.  
  263. // -----------
  264.  
  265. Beep(C4, full);
  266. Beep(G3, full);
  267. Beep(C4, full);
  268. Beep(G3, full);
  269. Beep(C4, full);
  270. Beep(G3, full);
  271. Beep(C4, half);
  272.  
  273. Beep(C3, half);
  274. Beep(D3, half);
  275. Beep(E3, half);
  276.  
  277. Beep(F4, full);
  278. Beep(C4, full);
  279. Beep(C4, full);
  280. Beep(G4, full);
  281. Beep(G4, half);
  282. Beep(G4, half);
  283. Beep(F4, half);
  284. Beep(D4, half);
  285. Beep(C4, full);
  286.  
  287. Sleep(full);
  288. }
  289.  
  290. void coupleBass()
  291. {
  292. Beep(C4, full);
  293. Beep(G3, full);
  294. Beep(C4, full);
  295. Beep(G3, full);
  296. Beep(C4, full);
  297. Beep(G3, full);
  298.  
  299. Beep(F3, full);
  300. Beep(C4, full);
  301. Beep(F3, full);
  302. Beep(C4, full);
  303.  
  304. Beep(G3, full);
  305. Beep(D4, full);
  306. Beep(G3, full);
  307. Beep(D4, full);
  308.  
  309. Beep(C4, full);
  310. Beep(G3, full);
  311.  
  312. // -----------
  313.  
  314. Beep(C4, full);
  315. Beep(G3, full);
  316. Beep(C4, full);
  317. Beep(G3, full);
  318. Beep(C4, full);
  319. Beep(G3, full);
  320.  
  321. Beep(F3, full);
  322. Beep(C4, full);
  323. Beep(F3, full);
  324. Beep(C4, full);
  325.  
  326. Beep(G3, full);
  327. Beep(D4, full);
  328. Beep(G3, full);
  329. Beep(D4, full);
  330.  
  331. Beep(C4, full);
  332. Beep(G3, full);
  333. }
  334.  
  335. int main()
  336. {
  337. int action, inCheck;
  338.  
  339. Begin:
  340.  
  341. puts("Happy New Year!!!\n");
  342.  
  343. puts("Select one option: ");
  344. puts("1. Melody");
  345. puts("2. Bass Line");
  346. puts("3. Application.Exit\n");
  347.  
  348. do
  349. {
  350. printf("Your action: ");
  351. inCheck = scanf("%d", &action);
  352. fflush(stdin);
  353. }
  354. while(!inCheck || (action < 1) || (action > 3));
  355.  
  356. if(action == 1)
  357. {
  358. refrenSolo();
  359. coupleSolo();
  360. refrenSolo();
  361.  
  362. system("cls");
  363. goto Begin;
  364. }
  365. else if(action == 2)
  366. {
  367. refrenBass();
  368. coupleBass();
  369. refrenBass();
  370.  
  371. system("cls");
  372. goto Begin;
  373. }
  374.  
  375. return 0;
  376. }

Report this snippet  

You need to login to post a comment.