如何编写读取文本生成的语音应用程序 [英] How to write an application that reads text and produces speech
本文介绍了如何编写读取文本生成的语音应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一个IT的学生。我想写为盲人的Web浏览器。我如何使用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)?
推荐答案
您可以使用从SpeechSynthesizer类。 .Net框架:
You can use the SpeechSynthesizer class from the .Net Framework:
- 添加一个引用到System.Speech.dll
- 添加using语句System.Speech.Synthesis
-
使用此代码:
- Add a reference to System.Speech.dll
- Add a using statement for System.Speech.Synthesis
Use this code:
SpeechSynthesizer synthesizer = new SpeechSynthesizer();
synthesizer.Speak("Hello world! How are you?");
这篇关于如何编写读取文本生成的语音应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文