如何编写读取文本并产生语音的应用程序
我是一名IT学生。我想为盲人编写一个网络浏览器。如何使用 C# 或 java 编写应用程序来发音 XML 文件中的某些文本(文本转语音)?
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)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以使用 SpeechSynthesizer 类 .Net Framework:
使用此代码:
You can use the SpeechSynthesizer class from the .Net Framework:
Use this code:
对于 .NET,请查看语音 API。 此处有对其的快速介绍。
希望这足以让您开始。
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.
可能值得查看网络的可访问性指南,这是一个很好的起点:http:// /www.w3.org/TR/WCAG10/
这至少会表明人们正在做什么来支持可访问性,这将使您了解您的应用程序应该做什么。 (例如读取 ALT 和 TITLE 标签)
C# 当然可以用于解析网页,除了 .NET 框架中内置的文本到语音转换之外,还有可以集成的第 3 方库。
您还可以查看现有的屏幕阅读器应用程序,以获得一些灵感:例如:http://www.freedomscientific.com/products/fs/jaws-product-page.asp
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
对于 Java,这个问题 为您提供了一些文本转语音选项,但编写整个网络浏览器的功能远不止文本转语音功能。除非您正在寻找专门的跨平台工具(我猜不是因为您将 .NET 作为一个选项),否则 Windows 附带了 TTS 可访问选项,当然还有内置的 Web 浏览器。
通过 .NET,您可以使用它的 语音 API 并与 Internet Explorer 交互以获得 Web 浏览器功能。绝对是最短的路线,但它可能不会比 Windows 内置的功能带来太多好处。
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.