这里是我的代码:
string _message = "Hello world.";
SpeechSynthesizer _synth = new SpeechSynthesizer();
Prompt _prompt = new Prompt(_message);
_synth.Speak(_prompt);
我不能为我的生活弄清楚究竟是什么原因造成这样的错误:
“输入字符串的不正确的格式。”
导致此错误的行是当我打电话_synth.Speak(_prompt);
编辑:我已经试过我的台式电脑上运行此代码,它工作正常所以什么是错的我安装我的笔记本电脑。 不过我不太知道如何解决这个问题?
编辑:
堆栈跟踪:
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffe
r& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo in
fo)
at System.Speech.Internal.SapiAttributeParser.GetCultureInfoFromLanguageStrin
g(String valueString)
at System.Speech.Synthesis.VoiceInfo..ctor(VoiceObjectToken token)
at System.Speech.Internal.Synthesis.VoiceSynthesis.BuildInstalledVoices(Voice
Synthesis voiceSynthesizer)
at System.Speech.Internal.Synthesis.VoiceSynthesis..ctor(WeakReference speech
Synthesizer)
at System.Speech.Synthesis.SpeechSynthesizer.get_VoiceSynthesizer()
at System.Speech.Synthesis.SpeechSynthesizer.Speak(Prompt prompt)
at TTSTesting.Program.Speak(String _message) in C:\Users\ctanaka\Desktop\TTST
esting\TTSTesting\Program.cs:line 22