更新时间:2023-12-06 10:45:58
方法很少.这完全取决于您需要哪种声音.
您需要文字转语音吗?使用程序集System.Speech
,请参见System.Speech.Recognition
: http://msdn.microsoft. com/en-us/library/system.speech.recognition.aspx [ ^ ].
您需要播放媒体文件吗?这也是可能的:
在WinForms应用程序中嵌入和播放WAV音频文件 [ nBASS:.NET的声音库 [适用于Windows 7的MP3播放器 [ C#MIDI工具包 [ WPF Midi乐队 [ C#中的低级音频播放器 [吸引声音 [在C#中编程音频效果 [
There are few approaches. It all depends on what sound do you need.
Do you need text-to-speech? Use the assemblySystem.Speech
, seeSystem.Speech.Recognition
: http://msdn.microsoft.com/en-us/library/system.speech.recognition.aspx[^].
Do you need to play media file? This is also possible:
Embedding and Playing WAV Audio Files in a WinForms Application[^],
nBASS: A sound libary for .NET[^],
MP3 Player for Windows 7[^].
You can also use P/Invoked MIDI interface:
C# MIDI Toolkit[^],
WPF Midi Band[^].
You can also synthesize waveforms on the fly, play different types of media, etc.
See:
A low-level audio player in C#[^],
Draw into sound[^],
Programming Audio Effects in C#[^].
This is only a small fraction of the wealth of articles available only on CodeProject.
What exactly do you want?
Google for it to find many possibilities.—SA