Results 1 to 7 of 7

Thread: [RESOLVED] text to voice

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2013
    Posts
    488

    Resolved [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

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    110,344

    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

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2013
    Posts
    488

    Re: text to voice

    thanks

  4. #4
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    558

    Re: text to voice

    From similar thread:

    Quote Originally Posted by peterst View Post
    ... There is Speech library in .NET you can use like this:

    VB.NET Code:
    1. Imports System.Speech.Synthesis
    2.  
    3. ...
    4. ...
    5. Dim synth As New SpeechSynthesizer
    6. synth.SetOutputToDefaultAudioDevice()
    7. synth.Speak("Some text...")
    8. ...
    9. ...
    Quote Originally Posted by peterst View Post
    About the async routines, the same library has async versions, but you have to declare synth variable outside the routines:

    VB.NET Code:
    1. Imports System.Speech.Synthesis
    2.  
    3. Private _synth As New SpeechSynthesizer
    4.  
    5. Private Sub SpeakText(byval text as String)
    6.     _synth.SetOutputToDefaultAudioDevice()
    7.     _synth.SpeakAsync(text)
    8. End Sub
    9.  
    10. Private Sub StopSpeaking()
    11.     If _synth.State = SynthesizerState.Speaking Then
    12.         _synth.SpeakAsyncCancelAll()
    13.     End If
    14. End Sub
    15.  
    16. Private Sub DoWork()
    17. ....
    18. ....
    19.     SpeakText("Some text...")
    20. ....
    21. ....
    22. End Sub

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2013
    Posts
    488

    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

  6. #6
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    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

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2013
    Posts
    488

    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
  •  



Click Here to Expand Forum to Full Width