开发者

How to convert text to speech on a web page?

开发者 https://www.devze.com 2022-12-21 01:44 出处:网络
I am making a web page that displays fragments of text from news sites (开发者_如何学JAVACNN, BBC, etc.) but I also want it to be read to people who can\'t see. How can I program the HTML page to read

I am making a web page that displays fragments of text from news sites (开发者_如何学JAVACNN, BBC, etc.) but I also want it to be read to people who can't see. How can I program the HTML page to read the text for them? Any ideas?

Thanks, Boda Cydo.


People who can't see will already be using either a screen reader (which will read the text to them), braille display or similar.

You just need to focus on making the text accessible and let their software handle "displaying" it to them.


The best way to make your website readable to people who cannot see is to use semantic HTML and follow standards. HTML readers can't magically infer your meaning if you don't. For example:

  • Use H1-H6 to designate the correct levels of titles in your site
  • Use P tags for body content
  • Use UL lists for navigation and A tags only for things that are really links
  • Use CSS for style - If an image is just used for style, put it in a background image instead
  • Only use tables for data that really is tabular.
  • If you have any content images, use IMG and provide ALT text
  • Use LABEL tags appropriately for forms
  • Use title attributes where appropriate
  • Most importantly - try turning off CSS in your browser. Does your web page still make sense to you? If so, you are probably on the right path.


No, you need to use Flash or a Java Applet to do this. There is nothing native in a browser for text-to-speech. Most people with these needs already have software that does this for them.


look to http://en.wikipedia.org/wiki/JAWS_%28screen_reader%29 . As far as i know it have integration with browsers


As Diodeus noted, if they have a need for text to speech then they will already have software to read for them. Just make the text available.

If you actually want to go through with implementing it yourself (though I wouldn't recommend it) then you can try to use the Google Translate API as described here. It looks like Google has taken down that text-to-speech site for now, but I assume (since it's Google after all) that they'll eventually release it. You may want to also look at the Android TTS library here.

0

精彩评论

暂无评论...
验证码 换一张
取 消