我的C#应用程序需要将文本转换为wav文件并将其注入到Skype通话中。创建wav文件的代码如下所示。问题在于该文件具有22kHz采样率,而Skype仅接受16kHz。
是否有任何方法可以调整此设置?
是否有任何方法可以调整此设置?
using (System.IO.FileStream stream = System.IO.File.Create("message.wav"))
{
System.Speech.Synthesis.SpeechSynthesizer speechEngine = new System.Speech.Synthesis.SpeechSynthesizer();
speechEngine.SetOutputToWaveStream(stream);
speechEngine.Speak(number);
stream.Flush();
}
SetOutputToAudioFile()
,或者是重载的SetOutputToWaveStream()
。已更新答案。 :) - Tanzelax