Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Public Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
- Public Declare Function MessageBeep Lib "User32" (ByVal wType As Long) As Long
- Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
- '====================================================================
- Public Sub Main()
- PlayMusic3
- End Sub
- '====================================================================
- ' http://www.codeincodeblock.com/2011/10/playing-sound-source-code-in-c.html
- '
- ' Twinkle twinkle
- ' CC GG AA G
- ' FF EE DD C
- ' GG FF EE D
- ' GG FF EE D
- ' CC GG AA G
- ' FF EE DD C
- '====================================================================
- Private Sub PlayMusic3()
- PlayNote "C", 0.4
- PlayNote "C", 0.4
- PlayNote "G", 0.4
- PlayNote "G", 0.4
- PlayNote "A", 0.4
- PlayNote "A", 0.4
- PlayNote "G", 0.4
- Sleep 400
- PlayNote "F", 0.4
- PlayNote "F", 0.4
- PlayNote "E", 0.4
- PlayNote "E", 0.4
- PlayNote "D", 0.4
- PlayNote "D", 0.4
- PlayNote "C", 0.4
- Sleep 400
- PlayNote "G", 0.4
- PlayNote "G", 0.4
- PlayNote "F", 0.4
- PlayNote "F", 0.4
- PlayNote "E", 0.4
- PlayNote "D", 0.4
- PlayNote "G", 0.4
- Sleep 400
- PlayNote "G", 0.4
- PlayNote "F", 0.4
- PlayNote "F", 0.4
- PlayNote "E", 0.4
- PlayNote "D", 0.4
- PlayNote "C", 0.4
- PlayNote "C", 0.4
- Sleep 400
- PlayNote "G", 0.4
- PlayNote "G", 0.4
- PlayNote "A", 0.4
- PlayNote "A", 0.4
- PlayNote "G", 0.4
- PlayNote "F", 0.4
- PlayNote "F", 0.4
- Sleep 400
- PlayNote "E", 0.4
- PlayNote "E", 0.4
- PlayNote "D", 0.4
- PlayNote "D", 0.4
- PlayNote "C", 0.4
- End Sub
- Private Sub PlayNote(ByVal G As String, ByVal L As Single)
- Select Case G
- Case "A", "a"
- Beep 2750, L * 1000
- Case "B", "b"
- Beep 3087, L * 1000
- Case "C", "c"
- Beep 1637, L * 1000
- Case "D", "d"
- Beep 1835, L * 1000
- Case "E", "e"
- Beep 2060, L * 1000
- Case "F", "f"
- Beep 2183, L * 1000
- Case "G", "g"
- Beep 2450, L * 1000
- End Select
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement