-
Aug 9th, 2020, 11:51 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] text to voice
Hello, I am using text to voice (sapi) for the first time. I have a working program to help kids with their spelling. It says the word, you type in the word, it checks the spelling. The issue I am having is the audio part, at best it is hard to understand. Is this the nature of the beast or can I improve the sound?
Thanks
George
PS Anyone wanting this program should let me know
-
Aug 9th, 2020, 12:05 PM
#2
Re: text to voice
It's probably a bit late to do anything about it now but SAPI has not been the first choice for .NET developers for a long time.
https://docs.microsoft.com/en-us/arc...nthesis-in-net
https://docs.microsoft.com/en-us/dot...tframework-4.8
-
Aug 9th, 2020, 12:15 PM
#3
Thread Starter
Hyperactive Member
-
Aug 9th, 2020, 01:23 PM
#4
Re: text to voice
From similar thread:
Originally Posted by peterst
... There is Speech library in .NET you can use like this:
VB.NET Code:
Imports System.Speech.Synthesis
...
...
Dim synth As New SpeechSynthesizer
synth.SetOutputToDefaultAudioDevice()
synth.Speak("Some text...")
...
...
Originally Posted by peterst
About the async routines, the same library has async versions, but you have to declare synth variable outside the routines:
VB.NET Code:
Imports System.Speech.Synthesis
Private _synth As New SpeechSynthesizer
Private Sub SpeakText(byval text as String)
_synth.SetOutputToDefaultAudioDevice()
_synth.SpeakAsync(text)
End Sub
Private Sub StopSpeaking()
If _synth.State = SynthesizerState.Speaking Then
_synth.SpeakAsyncCancelAll()
End If
End Sub
Private Sub DoWork()
....
....
SpeakText("Some text...")
....
....
End Sub
-
Aug 9th, 2020, 01:31 PM
#5
Thread Starter
Hyperactive Member
Re: text to voice
I went to the website provided by jmcilhinney and ran the code through a converter.
Code:
Imports System.Speech.Synthesis
Namespace KeepTalking
Class Program
Private Shared Sub Main(ByVal args As String())
Dim synthesizer = New SpeechSynthesizer()
synthesizer.SetOutputToDefaultAudioDevice()
synthesizer.Speak("All we need to do is to make sure we keep talking")
End Sub
End Class
End Namespace
I get two errors. the first is in this line Imports System.Speech.Synthesis.
The second is here Dim synthesizer = New SpeechSynthesizer()
Any help would be most apprecated.
Thanks
George
-
Aug 9th, 2020, 02:37 PM
#6
Re: text to voice
Add a reference to System.Speech.
If you're not sure how to do that:
1. In Solution Explorer, right click on the Project name.
2. Click References
3. Click Assemblies
4. Scroll to find System.Speech, and check the box next to it.
BB
-
Aug 9th, 2020, 03:23 PM
#7
Thread Starter
Hyperactive Member
Re: text to voice
Thank you
I was able to make it work!
George
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|