C# 转换音频存储流
嗨,我想将内存流转换为mp3,然后发送到 客户端和播放它: 这是我的asmx代码:C# 转换音频存储流,c#,asp.net,web-services,stream,C#,Asp.net,Web Services,Stream,嗨,我想将内存流转换为mp3,然后发送到 客户端和播放它: 这是我的asmx代码: [WebMethod] public byte[] StartSpeak(string Word) { MemoryStream ms = new MemoryStream(); using (System.Speech.Synthesis.SpeechSynthesizer synhesizer = new System.Speech.Synthesis.SpeechSynthesizer())
[WebMethod]
public byte[] StartSpeak(string Word)
{
MemoryStream ms = new MemoryStream();
using (System.Speech.Synthesis.SpeechSynthesizer synhesizer = new System.Speech.Synthesis.SpeechSynthesizer())
{
synhesizer.SelectVoiceByHints(System.Speech.Synthesis.VoiceGender.NotSet, System.Speech.Synthesis.VoiceAge.NotSet, 0, new System.Globalization.CultureInfo("en-US"));
synhesizer.SetOutputToWaveStream(ms);
synhesizer.Speak(Word);
}
return ms.ToArray();
}
谢谢。您有什么问题?@C.Evenhuis谢谢您的回答。首先,我如何使用naudio等库将波流转换为mp3,以及如何将音频发送到浏览器中运行。