音声合成の外人さんと会話するバッチファイル


とりあえず音声合成の会話する。
アポストロフィ ' が入れられないのが残念。
無理せず PowerShell スクリプト .ps1 で作るほうがいいかも。

以下のファイルをダブルクリックで実行。
文字化けするときは UTF-8 じゃなく Shift-JIS (ANSI) で保存。
(Windows10, Window7 等)

zira.bat


@echo off

call :_sp "こんにちは"
call :_sp2 "Kon  nyee  chih  waah."
call :_sp "お元気ですか?"
call :_sp2  "I am fine, and you too?"

pause
goto :eof


:_sp
echo %~1
PowerShell "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('%~1');"
goto :eof


:_sp2
echo %~1
PowerShell "Add-Type -AssemblyName System.Speech; $z = (New-Object System.Speech.Synthesis.SpeechSynthesizer); $z.SelectVoice('Microsoft Zira Desktop'); $z.Speak('%~1');"
goto :eof


しゃべらない? なら、
マイクロソフトスピーチプラットフォームをインストール。

 x86_SpeechPlatformRuntime¥SpeechPlatformRuntime.msi
  または
 x64_SpeechPlatformRuntime¥SpeechPlatformRuntime.msi

日本語を追加

 MSSpeech_SR_ja-JP_TELE.msi
 MSSpeech_TTS_ja-JP_Haruka.msi