コマンド ラインから MS Speech ユーティリティを使用する方法はありますか? Mac では実行できますが、Windows XP では参照が見つかりません。
7 に答える
トピックに関する私の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 では
- コマンドラインを使用してテキストを音声に変換する方法を参照してください。
- Google TTS を使用したコマンドライン関数(wget to mp3->mplayer)
- mplayerでGoogleを直接使用するコマンド:
/usr/bin/mplayer -ao alsa -really-quiet -noconsolecontrols "http://translate.google.com/translate_tts?ie=UTF-8&client=tw-ob&q=Hello%20World&tl=en"
;
Raspberry Pi、Win、OSX (または任意のリモート)で Node-Redを使用
コマンドが見つからない場合は、いつでも.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);
}
}
}
Balabolcaもあります: http://www.cross-plus-a.com/bconsole.htm
コマンド ライン ツールがありますbalcon.exe
。次のように使用できます。
リストボイス:
balcon.exe -l
音声ファイル:
balcon.exe -n "IVONA 2 Jennifer" -f file.txt
コマンドラインから話す:
balcon.exe -n "IVONA 2 Jennifer" -t "hello there"
より多くのコマンド ライン オプションが利用可能です。WineにSAPI5をインストールしたUbuntuで試してみました。それはうまく動作します。
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
最善の方法は、それを実行する小さなコマンド ライン ユーティリティを作成することです。テキストを読み込んで、ms tts ライブラリを使用するだけです。
もう 1 つの方法は、Cepstralを使用することです。優れたコマンド ライン ユーティリティが付属しており、ms tts よりも何年も優れたサウンドを提供します。