Vb.net 使用文件中的语音将文字转为语音?
Vb.net text to speech using voice from file?
我制作了一个简单的程序,它使用 sapi 5 来表达用户输入的任何内容,但我想使用保存在程序目录中的语音,这可能吗?我以前见过 C++ 程序这样做,但我不确定这将如何在 visual basic 中实现。
如果我错了请纠正我,但你想做的似乎是 录制 你的应用程序产生的声音,然后作为第 2 步,识别它返回正文。
要解决录音,您需要使用声卡的输入和磁盘上的 wav 文件输出来组成一个 Direct Show 过滤器图形。作为 VB 开发人员,您应该能够使用 deprecated ManagedDX 或其他类似的包装器来实现这一点。
为了解决 TTS 之后你需要将这个文件提供给一些识别 API,例如 Bing Speech API.
这两个主题都值得单独使用 google 和 Whosebuging。
我有一个旧项目,它是用 VB6 编写的,它的演讲时间是 word,也许你可以从中得到一些东西,我不知道。
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
这不是最好的方法,但它似乎是我能找到的唯一方法,你可以 google CircumReality 这是一个由某人创建的游戏,它使用文本到语音来获得开发者足够好的声音包括允许您发出声音和安装 .tts 文件的工具。
只需下载 CircumReality 并安装它并转到程序目录并从那里打开 MNLP.exe 您应该可以选择从文件安装 tts 语音。
我制作了一个简单的程序,它使用 sapi 5 来表达用户输入的任何内容,但我想使用保存在程序目录中的语音,这可能吗?我以前见过 C++ 程序这样做,但我不确定这将如何在 visual basic 中实现。
如果我错了请纠正我,但你想做的似乎是 录制 你的应用程序产生的声音,然后作为第 2 步,识别它返回正文。
要解决录音,您需要使用声卡的输入和磁盘上的 wav 文件输出来组成一个 Direct Show 过滤器图形。作为 VB 开发人员,您应该能够使用 deprecated ManagedDX 或其他类似的包装器来实现这一点。
为了解决 TTS 之后你需要将这个文件提供给一些识别 API,例如 Bing Speech API.
这两个主题都值得单独使用 google 和 Whosebuging。
我有一个旧项目,它是用 VB6 编写的,它的演讲时间是 word,也许你可以从中得到一些东西,我不知道。
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
这不是最好的方法,但它似乎是我能找到的唯一方法,你可以 google CircumReality 这是一个由某人创建的游戏,它使用文本到语音来获得开发者足够好的声音包括允许您发出声音和安装 .tts 文件的工具。
只需下载 CircumReality 并安装它并转到程序目录并从那里打开 MNLP.exe 您应该可以选择从文件安装 tts 语音。