问题
Is there a way to use text-to-speech capabilities of Windows Narrator in .NET applications? I want to use it or a similar service to read out loud strings from my C# application. Would that be possible?
回答1:
Ms has a speech API and now have a easily consumed managed interface.
回答2:
When using Visual Studio; in Solution Explorer.
- Right Click 'References' then click on 'Add Reference...'.
- Search for 'System.Speech' under 'Framework' then tick it.
- Click 'OK'
Then use code along the lines of the following:
System.Speech.Synthesis.SpeechSynthesizer mainSpeechSynthesizer = new System.Speech.Synthesis.SpeechSynthesizer();
mainSpeechSynthesizer.Speak("Test, test. Test! TEST.");
Here's a nice breakdown of how to use System.Speech.Synthesis
with examples:
Initialize and Manage the Speech Synthesizer
来源:https://stackoverflow.com/questions/9638965/use-windows-narrator-through-net