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