SHARE
TWEET

BeepTest0003.BAS

Linda-chan Jul 7th, 2015 221 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.   PlayMusic3
  10. End Sub
  11.  
  12. '====================================================================
  13. ' http://www.codeincodeblock.com/2011/10/playing-sound-source-code-in-c.html
  14. '
  15. ' Twinkle twinkle
  16. ' CC GG AA G
  17. ' FF EE DD C
  18. ' GG FF EE D
  19. ' GG FF EE D
  20. ' CC GG AA G
  21. ' FF EE DD C
  22. '====================================================================
  23. Private Sub PlayMusic3()
  24.   PlayNote "C", 0.4
  25.   PlayNote "C", 0.4
  26.   PlayNote "G", 0.4
  27.   PlayNote "G", 0.4
  28.   PlayNote "A", 0.4
  29.   PlayNote "A", 0.4
  30.   PlayNote "G", 0.4
  31.   Sleep 400
  32.   PlayNote "F", 0.4
  33.   PlayNote "F", 0.4
  34.   PlayNote "E", 0.4
  35.   PlayNote "E", 0.4
  36.   PlayNote "D", 0.4
  37.   PlayNote "D", 0.4
  38.   PlayNote "C", 0.4
  39.   Sleep 400
  40.   PlayNote "G", 0.4
  41.   PlayNote "G", 0.4
  42.   PlayNote "F", 0.4
  43.   PlayNote "F", 0.4
  44.   PlayNote "E", 0.4
  45.   PlayNote "D", 0.4
  46.   PlayNote "G", 0.4
  47.   Sleep 400
  48.   PlayNote "G", 0.4
  49.   PlayNote "F", 0.4
  50.   PlayNote "F", 0.4
  51.   PlayNote "E", 0.4
  52.   PlayNote "D", 0.4
  53.   PlayNote "C", 0.4
  54.   PlayNote "C", 0.4
  55.   Sleep 400
  56.   PlayNote "G", 0.4
  57.   PlayNote "G", 0.4
  58.   PlayNote "A", 0.4
  59.   PlayNote "A", 0.4
  60.   PlayNote "G", 0.4
  61.   PlayNote "F", 0.4
  62.   PlayNote "F", 0.4
  63.   Sleep 400
  64.   PlayNote "E", 0.4
  65.   PlayNote "E", 0.4
  66.   PlayNote "D", 0.4
  67.   PlayNote "D", 0.4
  68.   PlayNote "C", 0.4
  69. End Sub
  70.  
  71. Private Sub PlayNote(ByVal G As String, ByVal L As Single)
  72.   Select Case G
  73.     Case "A", "a"
  74.       Beep 2750, L * 1000
  75.     Case "B", "b"
  76.       Beep 3087, L * 1000
  77.     Case "C", "c"
  78.       Beep 1637, L * 1000
  79.     Case "D", "d"
  80.       Beep 1835, L * 1000
  81.     Case "E", "e"
  82.       Beep 2060, L * 1000
  83.     Case "F", "f"
  84.       Beep 2183, L * 1000
  85.     Case "G", "g"
  86.       Beep 2450, L * 1000
  87.   End Select
  88. 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