How to write an application that reads text and pr

2019-04-11 20:09发布

问题:

I'm an IT student. I want to write an web browser for blind people. How can I use C# or java to write an application to pronounce some text from a XML file (Text to Speech)?

回答1:

You can use the SpeechSynthesizer class from the .Net Framework:

  1. Add a reference to System.Speech.dll
  2. Add a using statement for System.Speech.Synthesis
  3. Use this code:

    SpeechSynthesizer synthesizer = new SpeechSynthesizer();
    synthesizer.Speak("Hello world! How are you?");
    


回答2:

For .NET, have a look at the Speech APIs. There's a quick introduction to it here.

Hope that's enough to get you started.



回答3:

It might be worth looking at accessibility guidelines for the web, this is a good place to start: http://www.w3.org/TR/WCAG10/

This will at least indicate what people are doing to support accessibility which will give you an idea of what your application should do. (eg reading ALT and TITLE tags)

C# can certainly be used to parse web pages and in addition to the text to speech built into the .NET framework there will be 3rd party libraries that you can integrate with.

You can also have a look at existing screen reader applications to give you some inspiration: eg: http://www.freedomscientific.com/products/fs/jaws-product-page.asp



回答4:

For Java, this question gives you some Text To Speach options, but writing a whole web browser has a lot more to it than just the text to speech. Unless you are looking for something specifically cross platform (which I'm guessing not since you include .NET as an option), Windows comes with TTS accessibility options and of course a web browser built in.

With .NET you can use it's Speech API and interact with Internet Explorer to get you the web browser functionality. Definitely the shortest route, but it may not bring much over the built in Windows abilities.