38

コマンド ラインから MS Speech ユーティリティを使用する方法はありますか? Mac では実行できますが、Windows XP では参照が見つかりません。

4

7 に答える 7

59

トピックに関する私の2セント、コマンドラインのワンライナー:

  • を使用してWin上でPowerShell.exe

      PowerShell -Command "Add-Type –AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('hello');"
    
  • を使用してWin上でmshta.exe

      mshta vbscript:Execute("CreateObject(""SAPI.SpVoice"").Speak(""Hello"")(window.close)")
    
  • を使用して OSX でsay

      say "hello"
    
  • ネイティブを使用する Ubuntu デスクトップ (>=2015)spd-say

      spd-say "hello"
    
  • 他の Linux では

  • Raspberry Pi、Win、OSX (または任意のリモート)で Node-Redを使用

    npm i node-red-contrib-sysmessage

于 2016-09-22T19:51:26.197 に答える
4

コマンドが見つからない場合は、いつでも.Net 3.0 からSystem.Speech.Synthesis.SpeechSynthesizerをラップできます(「System.Speech」を参照することを忘れないでください)。

using System.Speech.Synthesis;

namespace Talk
{
    class Program
    {
        static void Main(string[] args)
        {
            using (var ss = new SpeechSynthesizer())
                foreach (var toSay in args)
                    ss.Speak(toSay);
        }
    }
}
于 2009-06-24T20:17:40.917 に答える
4

Balabolcaもあります: http://www.cross-plus-a.com/bconsole.htm コマンド ライン ツールがありますbalcon.exe。次のように使用できます。

  1. リストボイス:

    balcon.exe -l
    
  2. 音声ファイル:

    balcon.exe -n "IVONA 2 Jennifer" -f file.txt
    
  3. コマンドラインから話す:

    balcon.exe -n "IVONA 2 Jennifer" -t "hello there"
    

より多くのコマンド ライン オプションが利用可能です。WineにSAPI5をインストールしたUbuntuで試してみました。それはうまく動作します。

于 2017-08-08T13:35:07.903 に答える
3
rem The user decides what to convert here
 :input
 cls
 echo Type in what you want the computer to say and then press the enter key.
 echo.
 set /p text=

 rem Making the temp file
 :num
 set num=%random%
 if exist temp%num%.vbs goto num
 echo ' > "temp%num%.vbs"
 echo set speech = Wscript.CreateObject("SAPI.spVoice") >> "temp%num%.vbs"
 echo speech.speak "%text%" >> "temp%num%.vbs"
 start temp%num%.vbs
 pause
 del temp%num%.vbs
 goto input



pause
于 2014-02-03T15:31:42.723 に答える
2

最善の方法は、それを実行する小さなコマンド ライン ユーティリティを作成することです。テキストを読み込んで、ms tts ライブラリを使用するだけです。

もう 1 つの方法は、Cepstralを使用することです。優れたコマンド ライン ユーティリティが付属しており、ms tts よりも何年も優れたサウンドを提供します。

于 2009-06-24T20:19:17.873 に答える