by Peter. (10 Submissions)
Category: Sound/MP3
Compatability: VB Script
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (21 Votes)
No interface, just the song using Beep API... XP Only, sorry. I didn't write this but thought it might be enjoyed after seeing a single beep get 5 globes :p.
' "Annie's Song"
' by John Denver
Option Explicit
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
Dim Note As Long
Dim Frequencies As String, Durations As String
Dim Frequency As Long, Duration As Long
Frequencies = "iiihfihfffhidadddfhihfffhihiiihfihffihfdadddfhihffhiki"
Durations = "aabbbfjaabbbbnaabbbfjaabcapaabbbfjaabbbbnaabbbfjaabcap"
Const E4 = 329.6276
For Note = 1 To Len(Frequencies)
Frequency = E4 * 2 ^ ((Asc(Mid$(Frequencies, Note, 1)) - 96) / 12)
Duration = (Asc(Mid$(Durations, Note, 1)) - 96) * 200 - 10
Beep Frequency, Duration
Sleep 10
DoEvents
Next
Unload Me
End Sub