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
Dim s As String
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 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 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 Combo3_Click()
Call program_change(0, 0, Combo3.ListIndex)
End Sub
Private Sub Command1_Click()
Dim selectedDeviceID As Integer
'假设你从某个地方获取了设备 ID,这里只是示例,实际情况可能需要根据你的程序逻辑进行修改。
selectedDeviceID = Combo1.ItemData(Combo1.ListIndex)
Call midi_OutOpen(selectedDeviceID)
End Sub
Private Sub Command2_Click()
Call midi_OutClose
End Sub
Private Sub Command3_Click()
Dim s1 As String
Dim s2 As String
Dim i As Integer
Dim midiNote1 As Integer
Dim midiNote2 As Integer
Dim note1 As String
Dim note2 As String
Dim k As Integer
k = Int(Text3.Text)
s1 = Text1.Text
s2 = Text2.Text '假设第二个文本框的名称为 Text2
For i = 1 To Len(s1) Or Len(s2) '取两个字符串长度中的较大值作为循环次数
If i <= Len(s1) Then
note1 = Mid(s1, i, 1)
Else
note1 = “” '如果第一个字符串结束了,设置为空字符串
End If
If i <= Len(s2) Then
note2 = Mid(s2, i, 1)
Else
note2 = "" '如果第二个字符串结束了,设置为空字符串
End If
Select Case note1
Case "-"
midiNote1 = 0
Case "1...."
midiNote1 = 1
Case "2...."
midiNote1 = 2
Case "3...."
midiNote1 = 3
Case "4...."
midiNote1 = 4
Case "5...."
midiNote1 = 5
Case "6...."
midiNote1 = 6
Case "7...."
midiNote1 = 7
Case "1..."
midiNote1 = 8
Case "2..."
midiNote1 = 9
Case "3..."
midiNote1 = 10
Case "4..."
midiNote1 = 11
Case "5..."
midiNote1 = 12
Case "6..."
midiNote1 = 13
Case "7..."
midiNote1 = 14
Case "1.."
midiNote1 = 15
Case "2.."
midiNote1 = 16
Case "3.."
midiNote1 = 17
Case "4.."
midiNote1 = 18
Case "5.."
midiNote1 = 19
Case "6.."
midiNote1 = 20
Case "7.."
midiNote1 = 21
Case "1."
midiNote1 = 22
Case "2."
midiNote1 = 23
Case "3."
midiNote1 = 24
Case "4."
midiNote1 = 25
Case "5."
midiNote1 = 26
Case "6."
midiNote1 = 27
Case "7."
midiNote1 = 28
Case "1"
midiNote1 = 29
Case "2"
midiNote1 = 30
Case "3"
midiNote1 = 31
Case "4"
midiNote1 = 32
Case "5"
midiNote1 = 33
Case "6"
midiNote1 = 34
Case "7"
midiNote1 = 35
Case "1'"
midiNote1 = 36
Case "2'"
midiNote1 = 37
Case "3'"
midiNote1 = 38
Case "4'"
midiNote1 = 39
Case "5'"
midiNote1 = 40
Case "6'"
midiNote1 = 41
Case "7'"
midiNote1 = 42
Case "1''"
midiNote1 = 43
Case "2''"
midiNote1 = 44
Case "3''"
midiNote1 = 45
Case "4''"
midiNote1 = 46
Case "5''"
midiNote1 = 47
Case "6''"
midiNote1 = 48
Case "7''"
midiNote1 = 49
Case "1'''"
midiNote1 = 50
Case "2'''"
midiNote1 = 51
Case "3'''"
midiNote1 = 52
Case "4'''"
midiNote1 = 53
Case "5'''"
midiNote1 = 54
Case "6'''"
midiNote1 = 55
Case "7'''"
midiNote1 = 56
Case "1''''"
midiNote1 = 57
Case "2''''"
midiNote1 = 58
Case "3''''"
midiNote1 = 59
Case "4''''"
midiNote1 = 60
Case "5''''"
midiNote1 = 61
Case "6''''"
midiNote1 = 62
Case "7''''"
midiNote1 = 63
Case Else
midiNote1 = 0
End Select
Select Case note2
Case "-"
midiNote2 = 0
Case "1...."
midiNote2 = 1
Case "2...."
midiNote2 = 2
Case "3...."
midiNote2 = 3
Case "4...."
midiNote2 = 4
Case "5...."
midiNote2 = 5
Case "6...."
midiNote2 = 6
Case "7...."
midiNote2 = 7
Case "1..."
midiNote2 = 8
Case "2..."
midiNote2 = 9
Case "3..."
midiNote2 = 10
Case "4..."
midiNote2 = 11
Case "5..."
midiNote2 = 12
Case "6..."
midiNote2 = 13
Case "7..."
midiNote2 = 14
Case "1.."
midiNote2 = 15
Case "2.."
midiNote2 = 16
Case "3.."
midiNote2 = 17
Case "4.."
midiNote2 = 18
Case "5.."
midiNote2 = 19
Case "6.."
midiNote2 = 20
Case "7.."
midiNote2 = 21
Case "1."
midiNote2 = 22
Case "2."
midiNote2 = 23
Case "3."
midiNote2 = 24
Case "4."
midiNote2 = 25
Case "5."
midiNote2 = 26
Case "6."
midiNote2 = 27
Case "7."
midiNote2 = 28
Case "1"
midiNote2 = 29
Case "2"
midiNote2 = 30
Case "3"
midiNote2 = 31
Case "4"
midiNote2 = 32
Case "5"
midiNote2 = 33
Case "6"
midiNote2 = 34
Case "7"
midiNote2 = 35
Case "1'"
midiNote2 = 36
Case "2'"
midiNote2 = 37
Case "3'"
midiNote2 = 38
Case "4'"
midiNote2 = 39
Case "5'"
midiNote2 = 40
Case "6'"
midiNote2 = 41
Case "7'"
midiNote2 = 42
Case "1''"
midiNote2 = 43
Case "2''"
midiNote2 = 44
Case "3''"
midiNote2 = 45
Case "4''"
midiNote2 = 46
Case "5''"
midiNote2 = 47
Case "6''"
midiNote2 = 48
Case "7''"
midiNote2 = 49
Case "1'''"
midiNote2 = 50
Case "2'''"
midiNote2 = 51
Case "3'''"
midiNote2 = 52
Case "4'''"
midiNote2 = 53
Case "5'''"
midiNote2 = 54
Case "6'''"
midiNote2 = 55
Case "7'''"
midiNote2 = 56
Case "1''''"
midiNote2 = 57
Case "2''''"
midiNote2 = 58
Case "3''''"
midiNote2 = 59
Case "4''''"
midiNote2 = 60
Case "5''''"
midiNote2 = 61
Case "6''''"
midiNote2 = 62
Case "7''''"
midiNote2 = 63
Case Else
midiNote2 = 0
End Select
If midiNote1 > 0 Then
Call note_on(0, midiNote1 + Sta, sudu) '使用 note_on 过程播放音符
'设置第一个音符的音色
Call program_change(0, 0, Combo2.ListIndex)
Else
Call note_off(0, 0) '如果没有音符,停止播放
End If
If midiNote2 > 0 Then
Call note_on(0, midiNote2 + Sta, sudu) '使用 note_on 过程播放音符
'设置第二个音符的音色
Call program_change(0, 0, Combo3.ListIndex)
Else
Call note_off(0, 0) '如果没有音符,停止播放
End If
Sleep 200
Next
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
Call fill_sound_list1
For i = 0 To 64
Picture1(i).DragMode = 1
Next
HScroll1.Value = 36
HScroll2.Value = 100
End Sub
Private Sub fill_sound_list()
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 fill_sound_list1()
Combo3.AddItem “大钢琴(声学钢琴)0”
Combo3.AddItem “明亮的钢琴1”
Combo3.AddItem “电钢琴2”
Combo3.AddItem “酒吧钢琴3”
Combo3.AddItem “柔和的电钢琴4”
Combo3.AddItem “加合唱效果的电钢琴5”
Combo3.AddItem “羽管键琴(拨弦古钢琴)6”
Combo3.AddItem “科拉维科特琴(击弦古钢琴)7”
Combo3.AddItem “钢片琴8”
Combo3.AddItem “钟琴9”
Combo3.AddItem “八音盒10”
Combo3.AddItem “颤音琴11”
Combo3.AddItem “马林巴12”
Combo3.AddItem “木琴13”
Combo3.AddItem “管钟14”
Combo3.AddItem “大扬琴15”
Combo3.AddItem “击杆风琴16”
Combo3.AddItem “打击式风琴17”
Combo3.AddItem “摇滚风琴18”
Combo3.AddItem “教堂风琴19”
Combo3.AddItem “簧管风琴20”
Combo3.AddItem “手风琴21”
Combo3.AddItem “口琴22”
Combo3.AddItem “探戈手风琴23”
Combo3.AddItem “尼龙弦吉他24”
Combo3.AddItem “钢弦吉他25”
Combo3.AddItem “爵士电吉他26”
Combo3.AddItem “清音电吉他27”
Combo3.AddItem “闷音电吉他28”
Combo3.AddItem “加驱动效果的电吉他29”
Combo3.AddItem “加失真效果的电吉他30”
Combo3.AddItem “吉他和音31”
Combo3.AddItem “大贝司(声学贝司)32”
Combo3.AddItem “电贝司(指弹)33”
Combo3.AddItem “电贝司(拨片)34”
Combo3.AddItem “无品贝司35”
Combo3.AddItem “掌击贝司136”
Combo3.AddItem “掌击贝司237”
Combo3.AddItem “电子合成贝司138”
Combo3.AddItem “电子合成贝司239”
Combo3.AddItem “小提琴40”
Combo3.AddItem “中提琴41”
Combo3.AddItem “大提琴42”
Combo3.AddItem “低音大提琴43”
Combo3.AddItem “弦乐群颤音音色44”
Combo3.AddItem “弦乐群拨弦音色45”
Combo3.AddItem “竖琴46”
Combo3.AddItem “定音鼓47”
Combo3.AddItem “弦乐合奏音色148”
Combo3.AddItem “弦乐合奏音色249”
Combo3.AddItem “合成弦乐合奏音色150”
Combo3.AddItem “合成弦乐合奏音色251”
Combo3.AddItem “人声合唱啊52”
Combo3.AddItem “人声嘟53”
Combo3.AddItem “合成人声54”
Combo3.AddItem “管弦乐敲击齐奏55”
Combo3.AddItem “小号56”
Combo3.AddItem “长号57”
Combo3.AddItem “大号58”
Combo3.AddItem “加弱音器小号59”
Combo3.AddItem “法国号(圆号)60”
Combo3.AddItem “铜管组(铜管乐器合奏音色)61”
Combo3.AddItem “合成铜管音色162”
Combo3.AddItem “合成铜管音色263”
Combo3.AddItem “高音萨克斯风64”
Combo3.AddItem “次中音萨克斯风65”
Combo3.AddItem “中音萨克斯风66”
Combo3.AddItem “低音萨克斯风67”
Combo3.AddItem “双簧管68”
Combo3.AddItem “英国管69”
Combo3.AddItem “巴松(大管)70”
Combo3.AddItem “单簧管(黑管)71”
Combo3.AddItem “短笛72”
Combo3.AddItem “长笛73”
Combo3.AddItem “竖笛74”
Combo3.AddItem “排箫75”
Combo3.AddItem “吹瓶声76”
Combo3.AddItem “日本尺八77”
Combo3.AddItem “口哨声78”
Combo3.AddItem “奥卡雷那79”
Combo3.AddItem “合成主音1(方波)80”
Combo3.AddItem “合成主音2(锯齿波)81”
Combo3.AddItem “合成主音382”
Combo3.AddItem “合成主音483”
Combo3.AddItem “合成主音584”
Combo3.AddItem “合成主音6(人声)85”
Combo3.AddItem “合成主音7(平行五度)86”
Combo3.AddItem “合成主音8(贝司加主音)87”
Combo3.AddItem “合成音色1(新世纪)88”
Combo3.AddItem “合成音色2(温暖)89”
Combo3.AddItem “合成音色390”
Combo3.AddItem “合成音色4(合唱)91”
Combo3.AddItem “合成音色592”
Combo3.AddItem “合成音色6(金属声)93”
Combo3.AddItem “合成音色7(光环)94”
Combo3.AddItem “合成音色895”
Combo3.AddItem “合成效果1雨声96”
Combo3.AddItem “合成效果2音轨97”
Combo3.AddItem “合成效果3水晶98”
Combo3.AddItem “合成效果4大气99”
Combo3.AddItem “合成效果5明亮100”
Combo3.AddItem “合成效果6鬼怪101”
Combo3.AddItem “合成效果7回声102”
Combo3.AddItem “合成效果8科幻103”
Combo3.AddItem “西塔尔(印度)104”
Combo3.AddItem “班卓琴(美洲)105”
Combo3.AddItem “三昧线(日本)106”
Combo3.AddItem “十三弦筝(日本)107”
Combo3.AddItem “卡林巴108”
Combo3.AddItem “风笛109”
Combo3.AddItem “民族提琴110”
Combo3.AddItem “唢呐111”
Combo3.AddItem “叮当铃112”
Combo3.AddItem “阿哥哥鼓113”
Combo3.AddItem “钢鼓114”
Combo3.AddItem “木鱼115”
Combo3.AddItem “太鼓116”
Combo3.AddItem “古高音鼓117”
Combo3.AddItem “合成鼓118”
Combo3.AddItem “铜钹119”
Combo3.AddItem “磨弦120”
Combo3.AddItem “呼吸声121”
Combo3.AddItem “海浪声122”
Combo3.AddItem “鸟鸣123”
Combo3.AddItem “电话铃124”
Combo3.AddItem “直升机125”
Combo3.AddItem “鼓掌声126”
Combo3.AddItem “枪声127”
Combo3.ListIndex = 10
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