TTS, the abbreviation for text to speech, is the technique of using speech to read texts aloud. At present, in the domestic application more is the queuing system
The TTS of the Windows platform, usually using Microsoft's own Speech API.
Windows XP comes with Speech API 5.1, which is supported by default in English only. If you want to read Chinese, you need to install Langpack, which supports simplified Chinese, but it is a boy's pronunciation.
Starting with Vista, the default comes with Microsoft Speech API 5.3, which works a lot better, but does not support XP, depressed
Below, let's say that C # uses TTS to read aloud the way text is implemented:
Starting with. NET 3.0, the. NET Framework provides a managed speech API call method, which is very fluid. Instead of having to stick to cumbersome unmanaged COM calls.
Implementation code for. Net 3.0:
using System.Speech.Synthesis; SpeechSynthesizer synth = new SpeechSynthesizer(); synth.Speak( "Hello, world! 你好么?" ); synth.Dispose(); |
Starting with. NET 4.0, adding the ability to dynamically bind dynamic bindings allows C # to use COM objects in a late-bound manner like vb.net, making direct COM calls very simple.
How. Net 4.0 is implemented:
Type type = Type.GetTypeFromProgID( "SAPI.SpVoice" ); dynamic spVoice = Activator.CreateInstance(type); spVoice.Speak( "你好,欢迎使用 CSharp 4.0!" ); |
Note: If it is an XP system and the TTS 5.1 language pack is not installed, the above reading will ignore all Chinese.
Here, I will also publish the TTS5.1, together:
SDK 5.1 Download, here
SDK 5.1 language Pack, here
SDK 5.1 Voice file, here
C # Speech-aloud text-tts implementation