SHARE
TWEET

BeepTest0002.BAS

Linda-chan Jul 7th, 2015 234 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Public Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
  4. Public Declare Function MessageBeep Lib "User32" (ByVal wType As Long) As Long
  5. Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
  6.  
  7. '====================================================================
  8. Public Sub Main()
  9.   PlayMusic2
  10. End Sub
  11.  
  12. '====================================================================
  13. ' http://processors.wiki.ti.com/index.php/Playing_The_Imperial_March
  14. '====================================================================
  15. Private Sub PlayMusic2()
  16.   Const note_c = 261
  17.   Const note_d = 294
  18.   Const note_e = 329
  19.   Const note_f = 349
  20.   Const note_g = 391
  21.   Const note_gS = 415
  22.   Const note_a = 440
  23.   Const note_aS = 455
  24.   Const note_b = 466
  25.   Const note_cH = 523
  26.   Const note_cSH = 554
  27.   Const note_dH = 587
  28.   Const note_dSH = 622
  29.   Const note_eH = 659
  30.   Const note_fH = 698
  31.   Const note_fSH = 740
  32.   Const note_gH = 784
  33.   Const note_gSH = 830
  34.   Const note_aH = 880
  35.  
  36.   Const ADD_TIME = 1.2
  37.  
  38.   Beep note_a, 500 * ADD_TIME
  39.   Beep note_a, 500 * ADD_TIME
  40.   Beep note_a, 500 * ADD_TIME
  41.   Beep note_f, 350 * ADD_TIME
  42.   Beep note_cH, 150 * ADD_TIME
  43.   Beep note_a, 500 * ADD_TIME
  44.   Beep note_f, 350 * ADD_TIME
  45.   Beep note_cH, 150 * ADD_TIME
  46.   Beep note_a, 650 * ADD_TIME
  47.  
  48.   Sleep 150 * ADD_TIME
  49.   ' End of first bit...
  50.  
  51.   Beep note_eH, 500 * ADD_TIME
  52.   Beep note_eH, 500 * ADD_TIME
  53.   Beep note_eH, 500 * ADD_TIME
  54.   Beep note_fH, 350 * ADD_TIME
  55.   Beep note_cH, 150 * ADD_TIME
  56.   Beep note_gS, 500 * ADD_TIME
  57.   Beep note_f, 350 * ADD_TIME
  58.   Beep note_cH, 150 * ADD_TIME
  59.   Beep note_a, 650 * ADD_TIME
  60.  
  61.   Sleep 150 * ADD_TIME
  62.   ' End of second bit...
  63.  
  64.   Beep note_aH, 500 * ADD_TIME
  65.   Beep note_a, 300 * ADD_TIME
  66.   Beep note_a, 150 * ADD_TIME
  67.   Beep note_aH, 400 * ADD_TIME
  68.   Beep note_gSH, 200 * ADD_TIME
  69.   Beep note_gH, 200 * ADD_TIME
  70.   Beep note_fSH, 125 * ADD_TIME
  71.   Beep note_fH, 125 * ADD_TIME
  72.   Beep note_fSH, 250 * ADD_TIME
  73.  
  74.   Sleep 250 * ADD_TIME
  75.  
  76.   Beep note_aS, 250 * ADD_TIME
  77.   Beep note_dSH, 400 * ADD_TIME
  78.   Beep note_dH, 200 * ADD_TIME
  79.   Beep note_cSH, 200 * ADD_TIME
  80.   Beep note_cH, 125 * ADD_TIME
  81.   Beep note_b, 125 * ADD_TIME
  82.   Beep note_cH, 250 * ADD_TIME
  83.  
  84.   Sleep 250 * ADD_TIME
  85.  
  86.   Beep note_f, 125 * ADD_TIME
  87.   Beep note_gS, 500 * ADD_TIME
  88.   Beep note_f, 375 * ADD_TIME
  89.   Beep note_a, 125 * ADD_TIME
  90.   Beep note_cH, 500 * ADD_TIME
  91.   Beep note_a, 375 * ADD_TIME
  92.   Beep note_cH, 125 * ADD_TIME
  93.   Beep note_eH, 650 * ADD_TIME
  94.   ' End of third bit... Though it doesn't play well let's repeat it!
  95.  
  96.   Beep note_aH, 500 * ADD_TIME
  97.   Beep note_a, 300 * ADD_TIME
  98.   Beep note_a, 150 * ADD_TIME
  99.   Beep note_aH, 400 * ADD_TIME
  100.   Beep note_gSH, 200 * ADD_TIME
  101.   Beep note_gH, 200 * ADD_TIME
  102.   Beep note_fSH, 125 * ADD_TIME
  103.   Beep note_fH, 125 * ADD_TIME
  104.   Beep note_fSH, 250 * ADD_TIME
  105.  
  106.   Sleep 250 * ADD_TIME
  107.  
  108.   Beep note_aS, 250 * ADD_TIME
  109.   Beep note_dSH, 400 * ADD_TIME
  110.   Beep note_dH, 200 * ADD_TIME
  111.   Beep note_cSH, 200 * ADD_TIME
  112.   Beep note_cH, 125 * ADD_TIME
  113.   Beep note_b, 125 * ADD_TIME
  114.   Beep note_cH, 250 * ADD_TIME
  115.  
  116.   Sleep 250 * ADD_TIME
  117.  
  118.   Beep note_f, 250 * ADD_TIME
  119.   Beep note_gS, 500 * ADD_TIME
  120.   Beep note_f, 375 * ADD_TIME
  121.   Beep note_cH, 125 * ADD_TIME
  122.   Beep note_a, 500 * ADD_TIME
  123.   Beep note_f, 375 * ADD_TIME
  124.   Beep note_cH, 125 * ADD_TIME
  125.   Beep note_a, 650 * ADD_TIME
  126.   ' End of the song...
  127. End Sub
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top