【问题标题】:Converting Stream to WMA将流转换为 WMA
【发布时间】:2012-11-02 02:48:56
【问题描述】:

我正在 Silverlight 中创建一个需要读取其内容的应用程序。我正在使用 WCF 服务将内容发送到服务器端,然后有这段代码可以将文本合成为语音。

public class SpeechService
{
  [OperationContract]
  public byte[] StartSpeak(string Text)
  {
    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("pl-PL"));
      synhesizer.SetOutputToWaveStream(ms);
      synhesizer.Speak(Text);
  }
  return ms.ToArray();
}

在客户端,我使用以下代码:http://elegantcode.com/2010/03/07/text-to-speech-in-silverlight-using-wcf/ 使用 MediaElement 向客户端播放创建的声音。

它有效,但我需要调整它,因为生成的流非常大 - 2 分钟的新闻超过 8MB。在过去的几天里,我正在浏览网页以解决两个问题: 1. 使用 wcf 将音频数据流式传输到 Silverlight 2. 在发送到客户端之前压缩音频

至于问题没有。 1我不知道如何实现它:/我会使用任何帮助或想法。 最难的是没有。 2是我无法将输出声音保存为文件。我需要即时进行编码并将压缩的声音发送到客户端。据我所知,最好的想法是编码为 AAC 或 WMA,因为这两者都受 MediaElement 支持。

我将不胜感激。谢谢。

【问题讨论】:

  • 真的没有人可以帮忙吗? :(

标签: c# .net silverlight audio stream


【解决方案1】:

Windows Azure 媒体服务可能值得一看。 http://www.windowsazure.com/en-us/home/features/media-services/

它提供“实时流媒体”,您可能会将其与您的音频一起使用。我已经使用它进行点播,但不是直播,流媒体,而且它真的很容易做到。只需将您的媒体“上传到云端”,它就会编码并为您提供一个端点。然后,您可以在 Silverlight 媒体元素中使用此端点来获取流媒体。

【讨论】:

    猜你喜欢
    • 2012-07-30
    • 1970-01-01
    • 2013-10-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-22
    • 1970-01-01
    相关资源
    最近更新 更多