1
我得到一個運行這個簡單程序的異常。語音合成器不起作用給出錯誤
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Speech.Synthesis;
namespace speechSynth1
{
class Program
{
static void Main(string[] args)
{
SpeechSynthesizer s = new SpeechSynthesizer();
s.Speak("Hello how are you");
}
}
}
這裏是例外。
Unhandled Exception : System.PlatformNotSupportedExecption : No voice installed on
the system or none available with the current security setting.
at Microsoft.Speech.Internal.Sythesis.VoiceSythesis..ctor<WeakReference speechSynthesizer>
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.get_VoiceSynthesizer()
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.Speak(Prompt prompt)
at Microsoft.Speech.Synthesis.SpeechSynthesis.SpeechSynthesizer.Speak(String textToSpeak)
at speechSynth1.Program.Main(String[] args) in c:\users\project\documents\visual studio 2010\Projects\speechSynth1\speechSynth1\Program.cs : line 14
我不明白什麼是錯的。我剛剛檢查了控制面板並正確安裝了聲音。