2012-05-12 11 views
4

私はデスクトップMacOSのC#Monoでコンソールアプリケーションを開発中です。 Macのテキストをスピーチプロセッサーに実行する方法はありますか?私は、コンソールアプリケーションが文字列に基づいて文を言うことを望みます。MacOSのMono Consoleアプリケーションのテキスト音声

ありがとうございます。

答えて

0

SpeechSynthesizerクラスを使用すると、インストールされている音声合成エンジンの機能にアクセスできます。

新しいSpeechSynthesizerオブジェクトを作成すると、デフォルトのシステム音声が使用されます。インストールされている音声合成(Text-to-Speech)音声の1つを使用するようにSpeechSynthesizerを構成するには、SelectVoiceまたはSelectVoiceByHintsメソッドを使用します。インストールされているボイスに関する情報を取得するには、GetInstalledVoicesメソッドとVoiceInfoクラスを使用します。

次の例は、SpeechSynthesizerオブジェクトを初期化し、文字列を話すコンソールアプリケーションの一部です。

using System; 
using System.Speech.Synthesis; 

namespace SampleSynthesis 
{ 
    class Program 
    { 
    static void Main(string[] args) 
    { 

     // Initialize a new instance of the SpeechSynthesizer. 
     SpeechSynthesizer synth = new SpeechSynthesizer(); 

     // Configure the audio output. 
     synth.SetOutputToDefaultAudioDevice(); 

     // Speak a string. 
     synth.Speak("This example demonstrates a basic use of Speech Synthesizer"); 

     Console.WriteLine(); 
     Console.WriteLine("Press any key to exit..."); 
     Console.ReadKey(); 
    } 
    } 
} 

さらに詳しい情報はhereです。

関連する問題