我制作了一个简单的程序,使用sapi 5来说出用户输入的任何内容,但我想使用保存在程序目录中的语音这可能吗?我以前见过c ++程序,但是我不确定它是如何在visual basic中实现的。
答案 0 :(得分:0)
如果我错了,请纠正我但你正在尝试做的似乎是你的应用产生的声音的录音,然后作为第2步,将其识别回来发短信。
要解决录制,您需要编写一个直接显示过滤器图形,其中包含声卡的输入,并且输出为磁盘上的wav文件。作为VB开发人员,您应该能够使用deprecated ManagedDX或类似其他包装器来实现此目的。
要解决 TTS ,您需要将此文件提供给某些识别API,例如Bing Speech API。
这两个主题都需要单独的谷歌搜索和堆栈溢出。
答案 1 :(得分:0)
我有一个旧项目,它用 VB6 编写,它的语音时间可以用来表达,也许你可以从中得到一些东西,我不知道。
Private Declare Function SndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Dim p As String
Dim sound(1 To 59) As String
Dim at As String
Dim minutes As String
Dim over As String
Private Sub Command1_Click()
Dim a As Integer
Dim b As Integer
Dim index As Integer
SndPlaySound at, 0
a = Val(Mid$(Time$, 1, 2))
b = Val(Mid$(Time$, 4, 2))
If b = 0 Then
If a > 0 And a <= 12 Then
SndPlaySound sound(a), 0
Else
SndPlaySound sound(a - 12), 0
End If
Exit Sub
End If
SndPlaySound sound(a), 0
SndPlaySound over, 0
SndPlaySound sound(b), 0
SndPlaySound minutes, 0
End Sub
Private Sub Timer1_Timer()
Label1 = Time$
End Sub
Private Sub Form_Load()
Label1 = Time$
p = App.Path + "\Sound\"
Speak
End Sub
Private Sub Speak()
at = p + "at.wav"
over = p + "over.wav"
minutes = p + "minutes.wav"
sound(1) = p + "1.wav"
sound(2) = p + "2.wav"
sound(3) = p + "3.wav"
sound(4) = p + "4.wav"
sound(5) = p + "5.wav"
sound(6) = p + "6.wav"
sound(7) = p + "7.wav"
sound(8) = p + "8.wav"
sound(9) = p + "9.wav"
sound(10) = p + "10.wav"
sound(11) = p + "11.wav"
sound(12) = p + "12.wav"
sound(13) = p + "13.wav"
sound(14) = p + "14.wav"
sound(15) = p + "15.wav"
sound(16) = p + "16.wav"
sound(17) = p + "17.wav"
sound(18) = p + "18.wav"
sound(19) = p + "19.wav"
sound(20) = p + "20.wav"
sound(21) = p + "21.wav"
sound(22) = p + "22.wav"
sound(23) = p + "23.wav"
sound(24) = p + "24.wav"
sound(25) = p + "25.wav"
sound(26) = p + "26.wav"
sound(27) = p + "27.wav"
sound(28) = p + "28.wav"
sound(29) = p + "29.wav"
sound(30) = p + "30.wav"
sound(31) = p + "31.wav"
sound(32) = p + "32.wav"
sound(33) = p + "33.wav"
sound(34) = p + "34.wav"
sound(35) = p + "35.wav"
sound(36) = p + "36.wav"
sound(37) = p + "37.wav"
sound(38) = p + "38.wav"
sound(39) = p + "39.wav"
sound(40) = p + "40.wav"
sound(41) = p + "41.wav"
sound(42) = p + "42.wav"
sound(43) = p + "43.wav"
sound(44) = p + "44.wav"
sound(45) = p + "45.wav"
sound(46) = p + "46.wav"
sound(47) = p + "47.wav"
sound(48) = p + "48.wav"
sound(49) = p + "49.wav"
sound(50) = p + "50.wav"
sound(51) = p + "51.wav"
sound(52) = p + "52.wav"
sound(53) = p + "53.wav"
sound(54) = p + "54.wav"
sound(55) = p + "55.wav"
sound(56) = p + "56.wav"
sound(57) = p + "57.wav"
sound(58) = p + "58.wav"
sound(59) = p + "59.wav"
End Sub
答案 2 :(得分:0)
这不是最好的方法,但它似乎是我能找到的唯一方法,你可以谷歌CircumReality它是由某人创造的游戏,它使用文本到语音的开发人员很好的声音包括工具允许你发出声音并安装.tts文件。
只需下载CircumReality并安装它并转到程序目录并从那里打开MNLP.exe,您可以选择从文件安装tts语音。