Use C # To write a reporting software

Source: Internet
Author: User

Some time ago, I downloaded an Android app "star hour Report" and thought it was quite helpful. I want to write a Windows reporting software by myself;

There are two types of reports:

Star reporting, that is, playing fixed voice files;

During voice reporting, text is converted to speech for the purpose;

Play audio files

C # class System. Media. soundplayersupports playback control of .wav files.

                                     PlayAudio(= 

However, you cannot play audio such as wma and mp3.

Because the voice package I downloaded is dominated by wma and mp3, I use another method to play the video.

        [System.Runtime.InteropServices.DllImport(    mciSendString( lpstrCommand,  lpstrReturnString,  uReturnLength,   PlayAudioByAPI(, , ,  + file + , , , , , , 

The WindowsMediaPlayer API is used to play audio files. As long as your WMP can play audio, you can play it in your program.

Text to Speech

Windows provides the text-to-speech function. C # provides the called class library Interop. SpeechLib. dll.

The method is simple. Add Interop. SpeechLib. dll reference in your project and reference it in the class:

 SpeechLib;

Add method:

          Speek(= = Voice.GetVoices().Item(

 

Voice. GetVoices (). Item (0); you can select different Voice engines by subscript, depending on the number of Voice engines installed on your computer;

Note: In windows, no voice package was installed by default (you can open "Control Panel"> "Speech Recognition"> "Text to Speech conversion" to view the package ), if no voice package exists, this function cannot be implemented;

Download: Interop. SpeechLib

Star voice package collected on the Network: Star voice package

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.