使用控制台应用程序发送文字

使用控制台应用程序发送文字

问题描述:

在Win10 x64,VS2017上开发。安装了Windows 10 SDK。

Developing on Win10 x64, VS2017. Windows 10 SDK installed.

我想编写一个简单的C#控制台应用程序(Framework 4.7),这样我就可以使用SSML语音合成标记语言进行文本到语音转换(TTS)。我似乎找不到在我的项目中引用正确的程序集的方法来使用我在
的地方看到的示例代码  http://www.c-sharpcorner.com/UploadFile/4e4e9d/speech-synthesizer -for-windows-10 /和  https://blogs.windows.com/buildingapps/2016/05/23/using-speech-in-your-uwp-apps-from-talking-to-conversing/#AOSFPXxcPJIzzQwp。 97. 

I want to write a simple C# console app (Framework 4.7) so I can do text-to-speech (TTS) using SSML Speech Synthesis Markup Language. I cannot seem to find a way to reference the right Assemblies in my project to use the sample code I have seen in places like http://www.c-sharpcorner.com/UploadFile/4e4e9d/speech-synthesizer-for-windows-10/ and https://blogs.windows.com/buildingapps/2016/05/23/using-speech-in-your-uwp-apps-from-talking-to-conversing/#AOSFPXxcPJIzzQwp.97. 

所有想法都表示赞赏。  谢谢!

All ideas appreciated.  Thanks!

嗨SCEF,

对于您的问题,您可以添加System.Speech的参考。

For your question, you could add reference of System.Speech.

请尝试以下代码。

 static void Main(string[] args)
        {
            // Initialize a new instance of the SpeechSynthesizer.
            SpeechSynthesizer synth = new SpeechSynthesizer();

            // Configure the audio output. 
            synth.SetOutputToDefaultAudioDevice();

            // Speak a string.
            synth.Speak("This example demonstrates a basic use of Speech Synthesizer");

        }

有关详细信息,请参阅MSDN文章。

For more details, please refer to the MSDN article.

https://msdn.microsoft.com/en-us/library/system.speech.synthesis.speechsynthesizer%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396#Examples

最诚挚的问候,

Wendy