Search Tools Links Login

Annie's Song by John Denver


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.

Original Author: Peter.

Code

'    "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

About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 83 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.