2011-12-27 15 views
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 

私は何が間違っているのか分かりません。私はコントロールパネルをチェックして、音声が正しくインストールされています。

答えて

0

Microsoft.Speechの代わりにSystem.Speechを使用してください。

関連する問題