0

它在本地系统上工作,但不在实时服务器上工作。我收到错误:

NullReferenceException: Object reference not set to an instance of an object.]
   System.Speech.Internal.ObjectTokens.SAPICategories.DefaultDeviceOut() +79
   System.Speech.Internal.Synthesis.VoiceSynthesis..ctor(WeakReference speechSynthesizer) +969
   System.Speech.Synthesis.SpeechSynthesizer.get_VoiceSynthesizer() +77
   System.Speech.Synthesis.SpeechSynthesizer.SetOutputToNull() +55
   System.Speech.Synthesis.SpeechSynthesizer.SetOutputStream(Stream stream, SpeechAudioFormatInfo formatInfo, Boolean headerInfo, Boolean closeStreamOnExit) +16
   System.Speech.Synthesis.SpeechSynthesizer.SetOutputToWaveStream(Stream audioDestination)
4

1 回答 1

0

确保您的服务器上正确安装了 Microsoft 语音平台。

另请参阅Microsoft Speech Platform SDK 11 要求和安装页面底部的此说明。

重要的

语音平台运行时 11 和语音平台 SDK 11 不包括用于语音识别或语音合成(TTS 或文本到语音)的运行时语言。您必须单独安装它们。运行时语言包括语言模型、声学模型和其他必要的数据,以提供语音引擎以执行特定语言的语音识别或 TTS。语音识别或语音合成有不同的运行时语言。您下载的运行时语言版本(例如版本 11.0)必须与您安装的语音平台运行时的版本相匹配。您可以使用此链接下载运行时语言。

最后,由于 nullref 专门出现在DefaultDeviceOut()方法中,请确保您的服务器实际上具有某种音频输出功能。

于 2021-12-02T12:13:02.067 回答