私は C# で書かれたプログラムと praat (音声学ソフトウェア) によって計算された値を持っています。Windows コンソール (cmd.exe) に結果を出力する praatcon.exe で実行されている praat スクリプトが既にあります。この結果を C# アプリケーションで使用できますか? どのように?
または、コマンド「sendsocket」などを使用して、結果を取得するためのより良い方法はありますか? これをどのように使用しますか?
編集:このコードでうまく機能します:
ProcessStartInfo si = new ProcessStartInfo();
si.FileName = "praatcon.exe"; //name of the handle program from sysinternals
//assumes that it is in the exe directory or in your path
//environment variable
//the following three lines are required to be able to read the output (StandardOutput)
//and hide the exe window.
si.RedirectStandardOutput = true;
si.WindowStyle = ProcessWindowStyle.Hidden;
si.UseShellExecute = false;
si.Arguments = "-a example.praat filename.wav"; //you can specify whatever parameters praatcon.exe needs here; -a is mandatory!
//these 4 lines create a process object, start it, then read the output to
//a new string variable "s"
Process p = new Process();
p.StartInfo = si;
p.Start();
string s = p.StandardOutput.ReadToEnd();
praatcon.exe で「-a」パラメータを使用することは非常に重要です。ここで説明を参照してください。