I've made a simple program that uses sapi 5 to say anything that the user enters but i would like to use a voice thats saved in the program directory is this possible? I've seen c++ programs do it before but i'm not sure how this would be achived in visual basic.
Correct me if I'm wrong but what you're trying to do seems to be the recording of the sounds your app produces, and then as step 2, recognizing it back to text.
To address the recording , you need to compose a Direct Show filter graph with input of your sound card and output being wav file on disk. As a VB developer you should be able to achieve this using deprecated ManagedDX or other wrappers like it.
To address TTS afterwards you need to feed this file to some recognition API, for instance Bing Speech API .
Both of these topics deserve separate googling and stackoverflowing.
I have an old project and it's written in VB6 , and it speech time in to word, maybe you can get something from this, i dont know.
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
This is not the best method but it seems like the only one i can find, You can google CircumReality it's a game created by someone and it uses text to speech for the voices the developer was nice enough to include tools that allow you to make voices and install .tts files.
Simply download CircumReality and install it and goto the program directory and open MNLP.exe from there you should have the option to install a tts voice from file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.