Implementation of-tts text in C # voice reading

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.