Private Declare Function GetKeyState% Lib “user32” (ByVal nVirtKey As Long)
Private Declare Sub Sleep Lib “kernel32” (ByVal dwMilliseconds As Long)
Private sudu As Integer
Private Const VK_LBUTTON& = &H1
Private isOgain As Boolean '是否重复按键
Private Sta As Integer
Private Declare Function midiOutGetDevCaps Lib “winmm.dll” Alias “midiOutGetDevCapsA” (ByVal uDeviceID As Long, lpCaps As MIDIOUTCAPS, ByVal uSize As Long) As Long
Private Declare Function midiOutGetNumDevs Lib “winmm” () As Integer
Private Declare Function MIDIOutOpen Lib “winmm.dll” Alias “midiOutOpen” (lphMidiOut As Long, ByVal uDeviceID As Long, ByVal dwCallback As Long, ByVal dwInstance As Long, ByVal dwFlags As Long) As Long
Private Declare Function midiOutClose Lib “winmm.dll” (ByVal hMidiOut As Long) As Long
Private Declare Function midiOutShortMsg Lib “winmm.dll” (ByVal hMidiOut As Long, ByVal dwMsg As Long) As Long
Private Declare Function midiOutGetErrorText Lib “winmm.dll” Alias “midiOutGetErrorTextA” (ByVal err As Long, ByVal lpText As String, ByVal uSize As Long) As Long
Private Const MAXERRORLENGTH = 128 ’ max error text length (including NULL)
Private Const MIDIMAPPER = (-1)
Private Const MIDI_MAPPER = (-1)
'MIDIOUTCAPS结构描述了Musical Instrument Digital Interface(MIDI)输入设备的性能
Private Type MIDIOUTCAPS
wMid As Integer
wPid As Integer ’ 产品 ID
vDriverVersion As Long ’ 设备版本
szPname As String * 32 ’ 设备 name
wTechnology As Integer ’ 设备类型
wVoices As Integer
wNotes As Integer
wChannelMask As Integer
dwSupport As Long
End Type
Dim hMidi As Long
’ 声明 API 函数
Private Declare Function CreateThread Lib “kernel32” (lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadId As Long) As Long
Private Declare Function WaitForSingleObject Lib “kernel32” (ByVal hHandle As Long, ByVal dwMilliseconds As Long) As Long
Private Const INFINITE = -1&
Private Type NoteInfo
channel As Integer
noteValue As Integer
duration As Integer
End Type
Private Track1Notes() As NoteInfo
Private Track2Notes() As NoteInfo
Private Function Midi_OutDevsToList(Obj As Control) As Boolean
Dim i As Integer
Dim midicaps As MIDIOUTCAPS
Dim isAdd As Boolean
Obj.Clear
isAdd = False
If midiOutGetDevCaps(MIDIMAPPER, midicaps, Len(midicaps)) = 0 Then '若获取设备信息成功
Obj.AddItem midicaps.szPname '添加设备名称
Obj.ItemData(Obj.NewIndex) = MIDIMAPPER '这是默认设备ID = -1
isAdd = True
End If
'添加其他设备
For i = 0 To midiOutGetNumDevs() - 1
If midiOutGetDevCaps(i, midicaps, Len(midicaps)) = 0 Then
Obj.AddItem midicaps.szPname
Obj.ItemData(Obj.NewIndex) = i
isAdd = True
End If
Next
Midi_OutDevsToList = isAdd
End Function
Private Function MIDI_OutOpen(ByVal dev_id As Integer) As Integer
Dim midi_error As Integer
midi_error = MIDIOutOpen(hMidi, dev_id, 0, 0, 0)
MIDI_OutOpen = (hMidi <> 0)
End Function
Private Sub ParseTrackNotes(trackText As String)
Dim currentChannel As Integer ’ 默认为 0 通道
Dim currentDuration As Integer ’ 默认为 200 毫秒的持续时间
ReDim Track1Notes(100) ’ 初始化 Track1Notes 数组大小为 10
ReDim Track2Notes(200) ’ 初始化 Track2Notes 数组大小为 20
currentChannel = 1
currentDuration = 200
Dim noteValue As Integer
Dim i As Integer
For i = 1 To Len(trackText)
Dim currentChar As String
currentChar = Mid(trackText, i, 1)
Select Case currentChar
Case "1" To "7"
noteValue = Val(currentChar) + 60 ' 例如,'1' 对应 25,'2' 对应 26 ,以此类推
Call note_on(currentChannel, noteValue, sudu)
Sleep currentDuration
Call note_off(currentChannel, noteValue)
Case "-"
' 表示延长当前音符的持续时间
currentDuration = currentDuration + 10 ' 延长 100 毫秒,您可以根据需要调整
Case Else
' 忽略其他字符
End Select
Next i
End Sub
Private Sub PlayTrack1(trackText As String)
Dim currentChannel1 As Integer
Dim currentDuration1 As Integer
currentChannel1 = 1
currentDuration1 = 200
Dim noteValue1 As Integer
Dim i As Integer
For i = 1 To Len(trackText)
Dim currentChar As String
currentChar = Mid(trackText, i, 1)
Select Case currentChar
Case "1" To "7"
noteValue1 = Val(currentChar) + 60 ' 例如,'1' 对应 25,'2' 对应 26 ,以此类推
Call note_on(currentChannel1, noteValue1, sudu)
Sleep currentDuration1
Call note_off(currentChannel1, noteValue1)
Case "-"
' 表示延长当前音符的持续时间
currentDuration1 = currentDuration1 + 10 ' 延长 100 毫秒,您可以根据需要调整
Case Else
' 忽略其他字符
End Select
Next i
End Sub
Private Sub PlayTrack2(trackText As String)
Dim currentChannel2 As Integer
Dim currentDuration2 As Integer
currentChannel2 = 2
currentDuration2 = 200
Dim noteValue2 As Integer
Dim j As Integer
For j = 1 To Len(trackText)
Dim currentChar As String
currentChar = Mid(trackText, j, 1)
Select Case currentChar
Case "1" To "7"
noteValue2 = Val(currentChar) + 60 ' 例如,'1' 对应 25,'2' 对应 26 ,以此类推
Call note_on(currentChannel2, noteValue2, sudu)
Sleep currentDuration2
Call note_off(currentChannel2, noteValue2)
Case "-"
' 表示延长当前音符的持续时间
currentDuration2 = currentDuration2 + 10 ' 延长 100 毫秒,您可以根据需要调整
Case Else
' 忽略其他字符
End Select
Next j
End Sub
Private Sub note_on(ch As Integer, ByVal kk As Integer, v As Integer)
Call midi_outshort(&H90 + ch, kk, v)
End Sub
Private Sub note_off(ch As Integer, ByVal kk As Integer)
Call midi_outshort(&H80 + ch, kk, 0)
End Sub
Private Sub midi_OutClose()
Dim midi_error As Integer
midi_error = midiOutClose(hMidi)
hMidi = 0
End Sub
Sub program_change(ch As Integer, cc0nr As Integer, ByVal pnr As Integer)
Call midi_outshort(&HC0 + ch, pnr, 0)
End Sub
Sub midi_outshort(b1 As Integer, b2 As Integer, b3 As Integer)
Dim midi_error As Integer
midi_error = midiOutShortMsg(hMidi, b3 * &H10000 + b2 * &H100 + b1)
End Sub
Private Sub Command3_Click() '播放2个文本里的简谱
’ 解析两个文本框中的简谱信息到相应的数组
ParseTrackNotes Text1.Text
ParseTrackNotes Text2.Text
Dim i As Integer
Dim j As Integer
' 同时播放两个音轨的音符
i = 0
j = 0
Do While (i < UBound(Track1Notes) Or j < UBound(Track2Notes))
If i < UBound(Track1Notes) Then
' 播放第一个音轨的音符
Call note_on(Track1Notes(i).channel, Track1Notes(i).noteValue, sudu)
Sleep Track1Notes(i).duration
Call note_off(Track1Notes(i).channel, Track1Notes(i).noteValue)
i = i + 1
End If
If j < UBound(Track2Notes) Then
' 播放第二个音轨的音符
Call note_on(Track2Notes(j).channel, Track2Notes(j).noteValue, sudu)
Sleep Track2Notes(j).duration
Call note_off(Track2Notes(j).channel, Track2Notes(j).noteValue)
j = j + 1
End If
Loop
End Sub
Private Sub Combo1_Click()
Dim dl As Integer
dl = MIDI_OutOpen(Combo1.ItemData(Combo1.ListIndex))
Combo1.ListIndex = 0
End Sub
Private Sub Combo2_Click()
Call program_change(0, 0, Combo2.ListIndex)
End Sub
Private Sub Command1_Click()
Call MIDI_OutOpen
End Sub
Private Sub Command2_Click()
Call midi_OutClose
End Sub
Private Sub Form_Load()
Dim Retu As Boolean
Dim i As Integer
Retu = Midi_OutDevsToList(Combo1)
Combo1.ListIndex = 0
Call fill_sound_list
For i = 0 To 64
Picture1(i).DragMode = 1
Next
HScroll1.Value = 36
HScroll2.Value = 100
End Sub
Private Sub fill_sound_list()
Dim s As String
Combo2.AddItem "大钢琴(声学钢琴)0"
Combo2.AddItem "明亮的钢琴1"
Combo2.AddItem "电钢琴2"
Combo2.AddItem "酒吧钢琴3"
Combo2.AddItem "柔和的电钢琴4"
Combo2.AddItem "加合唱效果的电钢琴5"
Combo2.AddItem "羽管键琴(拨弦古钢琴)6"
Combo2.AddItem "科拉维科特琴(击弦古钢琴)7"
Combo2.AddItem "钢片琴8"
Combo2.AddItem "钟琴9"
Combo2.AddItem "八音盒10"
Combo2.AddItem "颤音琴11"
Combo2.AddItem "马林巴12"
Combo2.AddItem "木琴13"
Combo2.AddItem "管钟14"
Combo2.AddItem "大扬琴15"
Combo2.AddItem "击杆风琴16"
Combo2.AddItem "打击式风琴17"
Combo2.AddItem "摇滚风琴18"
Combo2.AddItem "教堂风琴19"
Combo2.AddItem "簧管风琴20"
Combo2.AddItem "手风琴21"
Combo2.AddItem "口琴22"
Combo2.AddItem "探戈手风琴23"
Combo2.AddItem "尼龙弦吉他24"
Combo2.AddItem "钢弦吉他25"
Combo2.AddItem "爵士电吉他26"
Combo2.AddItem "清音电吉他27"
Combo2.AddItem "闷音电吉他28"
Combo2.AddItem "加驱动效果的电吉他29"
Combo2.AddItem "加失真效果的电吉他30"
Combo2.AddItem "吉他和音31"
Combo2.AddItem "大贝司(声学贝司)32"
Combo2.AddItem "电贝司(指弹)33"
Combo2.AddItem "电贝司(拨片)34"
Combo2.AddItem "无品贝司35"
Combo2.AddItem "掌击贝司136"
Combo2.AddItem "掌击贝司237"
Combo2.AddItem "电子合成贝司138"
Combo2.AddItem "电子合成贝司239"
Combo2.AddItem "小提琴40"
Combo2.AddItem "中提琴41"
Combo2.AddItem "大提琴42"
Combo2.AddItem "低音大提琴43"
Combo2.AddItem "弦乐群颤音音色44"
Combo2.AddItem "弦乐群拨弦音色45"
Combo2.AddItem "竖琴46"
Combo2.AddItem "定音鼓47"
Combo2.AddItem "弦乐合奏音色148"
Combo2.AddItem "弦乐合奏音色249"
Combo2.AddItem "合成弦乐合奏音色150"
Combo2.AddItem "合成弦乐合奏音色251"
Combo2.AddItem "人声合唱啊52"
Combo2.AddItem "人声嘟53"
Combo2.AddItem "合成人声54"
Combo2.AddItem "管弦乐敲击齐奏55"
Combo2.AddItem "小号56"
Combo2.AddItem "长号57"
Combo2.AddItem "大号58"
Combo2.AddItem "加弱音器小号59"
Combo2.AddItem "法国号(圆号)60"
Combo2.AddItem "铜管组(铜管乐器合奏音色)61"
Combo2.AddItem "合成铜管音色162"
Combo2.AddItem "合成铜管音色263"
Combo2.AddItem "高音萨克斯风64"
Combo2.AddItem "次中音萨克斯风65"
Combo2.AddItem "中音萨克斯风66"
Combo2.AddItem "低音萨克斯风67"
Combo2.AddItem "双簧管68"
Combo2.AddItem "英国管69"
Combo2.AddItem "巴松(大管)70"
Combo2.AddItem "单簧管(黑管)71"
Combo2.AddItem "短笛72"
Combo2.AddItem "长笛73"
Combo2.AddItem "竖笛74"
Combo2.AddItem "排箫75"
Combo2.AddItem "吹瓶声76"
Combo2.AddItem "日本尺八77"
Combo2.AddItem "口哨声78"
Combo2.AddItem "奥卡雷那79"
Combo2.AddItem "合成主音1(方波)80"
Combo2.AddItem "合成主音2(锯齿波)81"
Combo2.AddItem "合成主音382"
Combo2.AddItem "合成主音483"
Combo2.AddItem "合成主音584"
Combo2.AddItem "合成主音6(人声)85"
Combo2.AddItem "合成主音7(平行五度)86"
Combo2.AddItem "合成主音8(贝司加主音)87"
Combo2.AddItem "合成音色1(新世纪)88"
Combo2.AddItem "合成音色2(温暖)89"
Combo2.AddItem "合成音色390"
Combo2.AddItem "合成音色4(合唱)91"
Combo2.AddItem "合成音色592"
Combo2.AddItem "合成音色6(金属声)93"
Combo2.AddItem "合成音色7(光环)94"
Combo2.AddItem "合成音色895"
Combo2.AddItem "合成效果1雨声96"
Combo2.AddItem "合成效果2音轨97"
Combo2.AddItem "合成效果3水晶98"
Combo2.AddItem "合成效果4大气99"
Combo2.AddItem "合成效果5明亮100"
Combo2.AddItem "合成效果6鬼怪101"
Combo2.AddItem "合成效果7回声102"
Combo2.AddItem "合成效果8科幻103"
Combo2.AddItem "西塔尔(印度)104"
Combo2.AddItem "班卓琴(美洲)105"
Combo2.AddItem "三昧线(日本)106"
Combo2.AddItem "十三弦筝(日本)107"
Combo2.AddItem "卡林巴108"
Combo2.AddItem "风笛109"
Combo2.AddItem "民族提琴110"
Combo2.AddItem "唢呐111"
Combo2.AddItem "叮当铃112"
Combo2.AddItem "阿哥哥鼓113"
Combo2.AddItem "钢鼓114"
Combo2.AddItem "木鱼115"
Combo2.AddItem "太鼓116"
Combo2.AddItem "古高音鼓117"
Combo2.AddItem "合成鼓118"
Combo2.AddItem "铜钹119"
Combo2.AddItem "磨弦120"
Combo2.AddItem "呼吸声121"
Combo2.AddItem "海浪声122"
Combo2.AddItem "鸟鸣123"
Combo2.AddItem "电话铃124"
Combo2.AddItem "直升机125"
Combo2.AddItem "鼓掌声126"
Combo2.AddItem "枪声127"
Combo2.ListIndex = 0
End Sub
Private Sub HScroll1_Change()
Sta = HScroll1.Value
Label4.Caption = Diao(Sta Mod 12)
End Sub
Private Sub HScroll2_Change()
sudu = HScroll2.Value
End Sub
Private Sub Picture1_DragOver(Index As Integer, Source As Control, x As Single, Y As Single, State As Integer)
'完成发音
Static OldNote As Integer
If (OldNote <> Index) Then
Call note_off(0, OldNote + Sta)
Call note_on(0, Index + Sta, sudu) '参数分别为通道编号,音调,速度
OldNote = Index
isOgain = False
End If
End Sub
Private Function Diao(i As Integer) As String
Select Case i
Case 0
Diao = “C”
Case 1
Diao = “C#”
Case 2
Diao = “D”
Case 3
Diao = “D#”
Case 4
Diao = “E”
Case 5
Diao = “F”
Case 6
Diao = “F#”
Case 7
Diao = “G”
Case 8
Diao = “G#”
Case 9
Diao = “A”
Case 10
Diao = “A#”
Case 11
Diao = “B”
End Select
End Function
Private Sub Command4_Click()
Dim s As String
Dim i As Integer
Dim k As Integer
k = Int(Text3.Text)
s = Text1.Text
For i = 1 To Len(s)
Select Case Mid(s, i, 1)
Case “1…”
Call note_on(0, 1 + Sta, sudu)
Sleep k
Call note_off(0, 1 + Sta)
Case “2…”
Call note_on(0, 2 + Sta, sudu)
Sleep k
Call note_off(0, 2 + Sta)
Case “3…”
Call note_on(0, 3 + Sta, sudu)
Sleep k
Call note_off(0, 3 + Sta)
Case “4…”
Call note_on(0, 4 + Sta, sudu)
Sleep k
Call note_off(0, 4 + Sta)
Case “5…”
Call note_on(0, 5 + Sta, sudu)
Sleep k
Call note_off(0, 5 + Sta)
Case “6…”
Call note_on(0, 6 + Sta, sudu)
Sleep k
Call note_off(0, 6 + Sta)
Case “7…”
Call note_on(0, 7 + Sta, sudu)
Sleep k
Call note_off(0, 7 + Sta)
Case “1…”
Call note_on(0, 8 + Sta, sudu)
Sleep k
Call note_off(0, 8 + Sta)
Case “2…”
Call note_on(0, 9 + Sta, sudu)
Sleep k
Call note_off(0, 9 + Sta)
Case “3…”
Call note_on(0, 10 + Sta, sudu)
Sleep k
Call note_off(0, 10 + Sta)
Case “4…”
Call note_on(0, 11 + Sta, sudu)
Sleep k
Call note_off(0, 11 + Sta)
Case “5…”
Call note_on(0, 12 + Sta, sudu)
Sleep k
Call note_off(0, 12 + Sta)
Case “6…”
Call note_on(0, 13 + Sta, sudu)
Sleep k
Call note_off(0, 13 + Sta)
Case “7…”
Call note_on(0, 14 + Sta, sudu)
Sleep k
Call note_off(0, 14 + Sta)
Case “1…”
Call note_on(0, 15 + Sta, sudu)
Sleep k
Call note_off(0, 15 + Sta)
Case “2…”
Call note_on(0, 16 + Sta, sudu)
Sleep k
Call note_off(0, 16 + Sta)
Case “3…”
Call note_on(0, 17 + Sta, sudu)
Sleep k
Call note_off(0, 17 + Sta)
Case “4…”
Call note_on(0, 18 + Sta, sudu)
Sleep k
Call note_off(0, 18 + Sta)
Case “5…”
Call note_on(0, 19 + Sta, sudu)
Sleep k
Call note_off(0, 19 + Sta)
Case “6…”
Call note_on(0, 20 + Sta, sudu)
Sleep k
Call note_off(0, 20 + Sta)
Case “7…”
Call note_on(0, 21 + Sta, sudu)
Sleep k
Call note_off(0, 21 + Sta)
Case “1.”
Call note_on(0, 22 + Sta, sudu)
Sleep k
Call note_off(0, 22 + Sta)
Case “2.”
Call note_on(0, 23 + Sta, sudu)
Sleep k
Call note_off(0, 23 + Sta)
Case “3.”
Call note_on(0, 24 + Sta, sudu)
Sleep k
Call note_off(0, 24 + Sta)
Case “4.”
Call note_on(0, 25 + Sta, sudu)
Sleep k
Call note_off(0, 25 + Sta)
Case “5.”
Call note_on(0, 26 + Sta, sudu)
Sleep k
Call note_off(0, 26 + Sta)
Case “6.”
Call note_on(0, 27 + Sta, sudu)
Sleep k
Call note_off(0, 27 + Sta)
Case “7.”
Call note_on(0, 28 + Sta, sudu)
Sleep k
Call note_off(0, 28 + Sta)
Case “1”
Call note_on(0, 29 + Sta, sudu)
Sleep k
Call note_off(0, 29 + Sta)
Case “2”
Call note_on(0, 30 + Sta, sudu)
Sleep k
Call note_off(0, 30 + Sta)
Case “3”
Call note_on(0, 31 + Sta, sudu)
Sleep k
Call note_off(0, 31 + Sta)
Case “4”
Call note_on(0, 32 + Sta, sudu)
Sleep k
Call note_off(0, 32 + Sta)
Case “5”
Call note_on(0, 33 + Sta, sudu)
Sleep k
Call note_off(0, 33 + Sta)
Case “6”
Call note_on(0, 34 + Sta, sudu)
Sleep k
Call note_off(0, 34 + Sta)
Case “7”
Call note_on(0, 35 + Sta, sudu)
Sleep k
Call note_off(0, 35 + Sta)
Case “1’”
Call note_on(0, 36 + Sta, sudu)
Sleep k
Call note_off(0, 36 + Sta)
Case “2’”
Call note_on(0, 37 + Sta, sudu)
Sleep k
Call note_off(0, 37 + Sta)
Case “3’”
Call note_on(0, 38 + Sta, sudu)
Sleep k
Call note_off(0, 38 + Sta)
Case “4’”
Call note_on(0, 39 + Sta, sudu)
Sleep k
Call note_off(0, 39 + Sta)
Case “5’”
Call note_on(0, 40 + Sta, sudu)
Sleep k
Call note_off(0, 40 + Sta)
Case “6’”
Call note_on(0, 41 + Sta, sudu)
Sleep k
Call note_off(0, 41 + Sta)
Case “7’”
Call note_on(0, 42 + Sta, sudu)
Sleep k
Call note_off(0, 42 + Sta)
Case “1’'”
Call note_on(0, 43 + Sta, sudu)
Sleep k
Call note_off(0, 43 + Sta)
Case “2’'”
Call note_on(0, 44 + Sta, sudu)
Sleep k
Call note_off(0, 44 + Sta)
Case “3’'”
Call note_on(0, 45 + Sta, sudu)
Sleep k
Call note_off(0, 45 + Sta)
Case “4’'”
Call note_on(0, 46 + Sta, sudu)
Sleep k
Call note_off(0, 46 + Sta)
Case “5’'”
Call note_on(0, 47 + Sta, sudu)
Sleep k
Call note_off(0, 47 + Sta)
Case “6’'”
Call note_on(0, 48 + Sta, sudu)
Sleep k
Call note_off(0, 48 + Sta)
Case “7’'”
Call note_on(0, 49 + Sta, sudu)
Sleep k
Call note_off(0, 49 + Sta)
Case “1’‘’”
Call note_on(0, 50 + Sta, sudu)
Sleep k
Call note_off(0, 50 + Sta)
Case “2’‘’”
Call note_on(0, 51 + Sta, sudu)
Sleep k
Call note_off(0, 51 + Sta)
Case “3’‘’”
Call note_on(0, 52 + Sta, sudu)
Sleep k
Call note_off(0, 52 + Sta)
Case “4’‘’”
Call note_on(0, 53 + Sta, sudu)
Sleep k
Call note_off(0, 53 + Sta)
Case “5’‘’”
Call note_on(0, 54 + Sta, sudu)
Sleep k
Call note_off(0, 54 + Sta)
Case “6’‘’”
Call note_on(0, 55 + Sta, sudu)
Sleep k
Call note_off(0, 55 + Sta)
Case “7’‘’”
Call note_on(0, 56 + Sta, sudu)
Sleep k
Call note_off(0, 56 + Sta)
Case “1’‘’'”
Call note_on(0, 57 + Sta, sudu)
Sleep k
Call note_off(0, 57 + Sta)
Case “2’‘’'”
Call note_on(0, 58 + Sta, sudu)
Sleep k
Call note_off(0, 58 + Sta)
Case “3’‘’'”
Call note_on(0, 59 + Sta, sudu)
Sleep k
Call note_off(0, 59 + Sta)
Case “4’‘’'”
Call note_on(0, 60 + Sta, sudu)
Sleep k
Call note_off(0, 60 + Sta)
Case “5’‘’'”
Call note_on(0, 61 + Sta, sudu)
Sleep k
Call note_off(0, 61 + Sta)
Case “6’‘’'”
Call note_on(0, 62 + Sta, sudu)
Sleep k
Call note_off(0, 62 + Sta)
Case “7’‘’'”
Call note_on(0, 63 + Sta, sudu)
Sleep k
Call note_off(0, 63 + Sta)
Case “-”
Call note_off(0, 34 + Sta)
Sleep k
Call note_off(0, 34 + Sta)
End Select
Next
End Sub
Private Sub Command5_Click()
Dim s As String
Dim i As Integer
Dim k As Integer
k = Int(Text3.Text)
s = Text2.Text
For i = 1 To Len(s)
Select Case Mid(s, i, 1)
Case “1…”
Call note_on(0, 1 + Sta, sudu)
Sleep k
Call note_off(0, 1 + Sta)
Case “2…”
Call note_on(0, 2 + Sta, sudu)
Sleep k
Call note_off(0, 2 + Sta)
Case “3…”
Call note_on(0, 3 + Sta, sudu)
Sleep k
Call note_off(0, 3 + Sta)
Case “4…”
Call note_on(0, 4 + Sta, sudu)
Sleep k
Call note_off(0, 4 + Sta)
Case “5…”
Call note_on(0, 5 + Sta, sudu)
Sleep k
Call note_off(0, 5 + Sta)
Case “6…”
Call note_on(0, 6 + Sta, sudu)
Sleep k
Call note_off(0, 6 + Sta)
Case “7…”
Call note_on(0, 7 + Sta, sudu)
Sleep k
Call note_off(0, 7 + Sta)
Case “1…”
Call note_on(0, 8 + Sta, sudu)
Sleep k
Call note_off(0, 8 + Sta)
Case “2…”
Call note_on(0, 9 + Sta, sudu)
Sleep k
Call note_off(0, 9 + Sta)
Case “3…”
Call note_on(0, 10 + Sta, sudu)
Sleep k
Call note_off(0, 10 + Sta)
Case “4…”
Call note_on(0, 11 + Sta, sudu)
Sleep k
Call note_off(0, 11 + Sta)
Case “5…”
Call note_on(0, 12 + Sta, sudu)
Sleep k
Call note_off(0, 12 + Sta)
Case “6…”
Call note_on(0, 13 + Sta, sudu)
Sleep k
Call note_off(0, 13 + Sta)
Case “7…”
Call note_on(0, 14 + Sta, sudu)
Sleep k
Call note_off(0, 14 + Sta)
Case “1…”
Call note_on(0, 15 + Sta, sudu)
Sleep k
Call note_off(0, 15 + Sta)
Case “2…”
Call note_on(0, 16 + Sta, sudu)
Sleep k
Call note_off(0, 16 + Sta)
Case “3…”
Call note_on(0, 17 + Sta, sudu)
Sleep k
Call note_off(0, 17 + Sta)
Case “4…”
Call note_on(0, 18 + Sta, sudu)
Sleep k
Call note_off(0, 18 + Sta)
Case “5…”
Call note_on(0, 19 + Sta, sudu)
Sleep k
Call note_off(0, 19 + Sta)
Case “6…”
Call note_on(0, 20 + Sta, sudu)
Sleep k
Call note_off(0, 20 + Sta)
Case “7…”
Call note_on(0, 21 + Sta, sudu)
Sleep k
Call note_off(0, 21 + Sta)
Case “1.”
Call note_on(0, 22 + Sta, sudu)
Sleep k
Call note_off(0, 22 + Sta)
Case “2.”
Call note_on(0, 23 + Sta, sudu)
Sleep k
Call note_off(0, 23 + Sta)
Case “3.”
Call note_on(0, 24 + Sta, sudu)
Sleep k
Call note_off(0, 24 + Sta)
Case “4.”
Call note_on(0, 25 + Sta, sudu)
Sleep k
Call note_off(0, 25 + Sta)
Case “5.”
Call note_on(0, 26 + Sta, sudu)
Sleep k
Call note_off(0, 26 + Sta)
Case “6.”
Call note_on(0, 27 + Sta, sudu)
Sleep k
Call note_off(0, 27 + Sta)
Case “7.”
Call note_on(0, 28 + Sta, sudu)
Sleep k
Call note_off(0, 28 + Sta)
Case “1”
Call note_on(0, 29 + Sta, sudu)
Sleep k
Call note_off(0, 29 + Sta)
Case “2”
Call note_on(0, 30 + Sta, sudu)
Sleep k
Call note_off(0, 30 + Sta)
Case “3”
Call note_on(0, 31 + Sta, sudu)
Sleep k
Call note_off(0, 31 + Sta)
Case “4”
Call note_on(0, 32 + Sta, sudu)
Sleep k
Call note_off(0, 32 + Sta)
Case “5”
Call note_on(0, 33 + Sta, sudu)
Sleep k
Call note_off(0, 33 + Sta)
Case “6”
Call note_on(0, 34 + Sta, sudu)
Sleep k
Call note_off(0, 34 + Sta)
Case “7”
Call note_on(0, 35 + Sta, sudu)
Sleep k
Call note_off(0, 35 + Sta)
Case “1’”
Call note_on(0, 36 + Sta, sudu)
Sleep k
Call note_off(0, 36 + Sta)
Case “2’”
Call note_on(0, 37 + Sta, sudu)
Sleep k
Call note_off(0, 37 + Sta)
Case “3’”
Call note_on(0, 38 + Sta, sudu)
Sleep k
Call note_off(0, 38 + Sta)
Case “4’”
Call note_on(0, 39 + Sta, sudu)
Sleep k
Call note_off(0, 39 + Sta)
Case “5’”
Call note_on(0, 40 + Sta, sudu)
Sleep k
Call note_off(0, 40 + Sta)
Case “6’”
Call note_on(0, 41 + Sta, sudu)
Sleep k
Call note_off(0, 41 + Sta)
Case “7’”
Call note_on(0, 42 + Sta, sudu)
Sleep k
Call note_off(0, 42 + Sta)
Case “1’'”
Call note_on(0, 43 + Sta, sudu)
Sleep k
Call note_off(0, 43 + Sta)
Case “2’'”
Call note_on(0, 44 + Sta, sudu)
Sleep k
Call note_off(0, 44 + Sta)
Case “3’'”
Call note_on(0, 45 + Sta, sudu)
Sleep k
Call note_off(0, 45 + Sta)
Case “4’'”
Call note_on(0, 46 + Sta, sudu)
Sleep k
Call note_off(0, 46 + Sta)
Case “5’'”
Call note_on(0, 47 + Sta, sudu)
Sleep k
Call note_off(0, 47 + Sta)
Case “6’'”
Call note_on(0, 48 + Sta, sudu)
Sleep k
Call note_off(0, 48 + Sta)
Case “7’'”
Call note_on(0, 49 + Sta, sudu)
Sleep k
Call note_off(0, 49 + Sta)
Case “1’‘’”
Call note_on(0, 50 + Sta, sudu)
Sleep k
Call note_off(0, 50 + Sta)
Case “2’‘’”
Call note_on(0, 51 + Sta, sudu)
Sleep k
Call note_off(0, 51 + Sta)
Case “3’‘’”
Call note_on(0, 52 + Sta, sudu)
Sleep k
Call note_off(0, 52 + Sta)
Case “4’‘’”
Call note_on(0, 53 + Sta, sudu)
Sleep k
Call note_off(0, 53 + Sta)
Case “5’‘’”
Call note_on(0, 54 + Sta, sudu)
Sleep k
Call note_off(0, 54 + Sta)
Case “6’‘’”
Call note_on(0, 55 + Sta, sudu)
Sleep k
Call note_off(0, 55 + Sta)
Case “7’‘’”
Call note_on(0, 56 + Sta, sudu)
Sleep k
Call note_off(0, 56 + Sta)
Case “1’‘’'”
Call note_on(0, 57 + Sta, sudu)
Sleep k
Call note_off(0, 57 + Sta)
Case “2’‘’'”
Call note_on(0, 58 + Sta, sudu)
Sleep k
Call note_off(0, 58 + Sta)
Case “3’‘’'”
Call note_on(0, 59 + Sta, sudu)
Sleep k
Call note_off(0, 59 + Sta)
Case “4’‘’'”
Call note_on(0, 60 + Sta, sudu)
Sleep k
Call note_off(0, 60 + Sta)
Case “5’‘’'”
Call note_on(0, 61 + Sta, sudu)
Sleep k
Call note_off(0, 61 + Sta)
Case “6’‘’'”
Call note_on(0, 62 + Sta, sudu)
Sleep k
Call note_off(0, 62 + Sta)
Case “7’‘’'”
Call note_on(0, 63 + Sta, sudu)
Sleep k
Call note_off(0, 63 + Sta)
Case “-”
Call note_off(0, 34 + Sta)
Sleep k
Call note_off(0, 34 + Sta)
End Select
Next
End Sub