1

It is working on local system but not working on live server. I am getting error:

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)
Martin Devillers
  • 17,293
  • 5
  • 46
  • 88
Ajad Patel
  • 11
  • 2
  • Does this answer your question? [What is a NullReferenceException, and how do I fix it?](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – SᴇM Feb 27 '20 at 08:14
  • Are you using any dependencies which are installed locally and not on the server ? – Aditya Bhave Feb 27 '20 at 08:18

1 Answers1

2

Make sure you that the Microsoft Speech Platform is correctly installed on your server.

Also see this note at the bottom of the Microsoft Speech Platform SDK 11 Requirements and Installation page.

Important

The Speech Platform Runtime 11 and the Speech Platform SDK 11 do not include Runtime Languages for speech recognition or for speech synthesis (TTS or text-to-speech). You must install them separately. A Runtime Language includes the language model, acoustic model, and other data necessary to provision a speech engine to perform speech recognition or TTS in a particular language. There are separate Runtime Languages for speech recognition or speech synthesis. The version of Runtime Languages that you download (for example, version 11.0) must match the version of the Speech Platform Runtime that you have installed. You can download Runtime Languages using this link.

Finally, seeing as the nullref occurs specifically at the DefaultDeviceOut() method, ensure your server actually has some kind of audio out capability.

Martin Devillers
  • 17,293
  • 5
  • 46
  • 88