' FB 1.05.0 Win64 ' Using Beep function in Win32 API Dim As Any Ptr library = DyLibLoad("kernel32") Dim Shared beep_ As Function (ByVal As ULong, ByVal As ULong) As Long beep_ = DyLibSymbol(library, "Beep") Sub playMorse(m As String) For i As Integer = 0 To Len(m) - 1 If m[i] = 46 Then '' ascii code for dot beep_(1000, 250) Else '' must be ascii code for dash (45) beep_(1000, 750) End If Sleep 50 Next Sleep 150 End Sub Dim morse(0 To 35) As String => _ { _ ".-", _ '' a "-...", _ '' b "-.-.", _ '' c "-..", _ '' d ".", _ '' e "..-.", _ '' f "--.", _ '' g "....", _ '' h "..", _ '' i ".---", _ '' j "-.-", _ '' k ".-..", _ '' l "--", _ '' m "-.", _ '' n "---", _ '' o ".--.", _ '' p "--.-", _ '' q ".-.", _ '' r "...", _ '' s "-", _ '' t "..-", _ '' u "...-", _ '' v ".--", _ '' w "-..-", _ '' x "-.--", _ '' y "--..", _ '' z "-----", _ '' 0 ".----", _ '' 1 "..---", _ '' 2 "...--", _ '' 3 "....-", _ '' 4 ".....", _ '' 5 "-....", _ '' 6 "--...", _ '' 7 "---..", _ '' 8 "----." _ '' 9 } Dim s As String = "The quick brown fox" For i As Integer = 0 To Len(s) -1 Select Case As Const s[i] Case 65 To 90 '' A - Z playMorse(morse(s[i] - 65)) Case 97 To 122 '' a - z playMorse(morse(s[i] - 97)) Case 48 To 57 '' 0 - 9 playMorse(morse(s[i] - 22)) Case Else '' ignore any other character Sleep 250 End Select Next DyLibFree(library) End