i've wanted to try out the SSML but everytime i try to run my code i get a null exception at SetOutputToDefaultAudioDevice() .
I am using the Example Code from Microsoft:
using System;
using System.Speech.Synthesis;
namespace SSML_Test
{
class Program
{
static void Main(string[] args)
{
// Initialize a new instance of the speech synthesizer.
using (SpeechSynthesizer synth = new SpeechSynthesizer())
{
// Configure the synthesizer to send output to the default audio device.
synth.SetOutputToDefaultAudioDevice();
// Speak a phrase.
synth.Speak("This is sample text-to-speech output.");
}
Console.WriteLine();
Console.WriteLine("Press any key to exit...");
Console.ReadKey();
}
}
I'm on .NET Core 2.0 and I've correctly added the System.Speech to my References.
Full Error Log:
System.NullReferenceException
HResult=0x80004003
Nachricht = Object reference not set to an instance of an object.
Quelle = System.Speech
Stapelüberwachung:
at
System.Speech.Internal.ObjectTokens.RegistryDataKey.HKEYfromRegKey
(RegistryKey regKey)
at System.Speech.Internal.ObjectTokens.RegistryDataKey.RootHKEYFromRegPath
(String rootPath)
at System.Speech.Internal.ObjectTokens.RegistryDataKey.Open(String
registryPath, Boolean fCreateIfNotExist)
at System.Speech.Internal.ObjectTokens.SAPICategories.DefaultDeviceOut()
at System.Speech.Internal.Synthesis.VoiceSynthesis..ctor(WeakReference
speechSynthesizer)
at System.Speech.Synthesis.SpeechSynthesizer.get_VoiceSynthesizer()
at System.Speech.Synthesis.SpeechSynthesizer.SetOutputToNull()
at System.Speech.Synthesis.SpeechSynthesizer.SetOutputStream(Stream stream,
SpeechAudioFormatInfo formatInfo, Boolean headerInfo, Boolean
closeStreamOnExit)
at System.Speech.Synthesis.SpeechSynthesizer.SetOutputToDefaultAudioDevice()
at SSML_Test.Program.Main(String[] args) in C:\Users\User\source\repos\SSML
Test\SSML Test\Program.cs:line 15
Does someone know what my Problem is?
User contributions licensed under CC BY-SA 3.0