문제

명령줄에서 MS Speech 유틸리티를 사용할 수 있는 방법이 있습니까?Mac에서는 할 수 있지만 Windows XP에서는 이에 대한 참조를 찾을 수 없습니다.

감사해요.

도움이 되었습니까?

해결책

나는 그것에 대한 명령 줄 도구가 있다고 생각하지 않지만 누군가가 하나를 썼습니다.

http://krolik.net/post/say-exe-a-sime-command-line-text-text-peech-prephram-for-windows.aspx

다른 팁

주제에 대한 나의 2 센트, 명령 줄 1 라이너 :

  • 사용 중입니다 PowerShell.exe

    PowerShell -Command "Add-Type –AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('hello');"
    
  • 사용 중입니다 mshta.exe

    mshta vbscript:Execute("CreateObject(""SAPI.SpVoice"").Speak(""Hello"")(window.close)")
    
  • 사용 중입니다 say

    say "hello"
    
  • 기본을 사용하는 우분투 데스크탑 (> = 2015) spd-say

    spd-say "hello"
    
  • 다른 Linux에서

  • Raspberry Pi에서, Win, OSX 사용 노드-레드

    npm i 노드-레드-컨트리브-스미지

Peter 's Text to Speech라는 Windows에서 요구하는 멋진 오픈 소스 프로그램이 있습니다. http://jampal.sourceforge.net/ptts.html

표준 입력에서 텍스트를 말할 ptts.exe라는 바이너리가 포함되어 있으므로 다음과 같이 실행할 수 있습니다.

echo hello there | ptts.exe

또는 다음 3 줄의 VBS 스크립트를 사용하여 유사한 기본 TTS를 얻을 수 있습니다.

'say.vbs
set s = CreateObject("SAPI.SpVoice")
s.Speak Wscript.Arguments(0), 3
s.WaitUntilDone(1000)

그리고 당신은 다음과 같은 명령 줄에서 그것을 호출 할 수 있습니다.

cscript say.vbs "hello there"

스크립트 경로로 이동하면 변수 시간 초과 및 오류 처리로 더 광범위한 코드 예제를 찾고 싶을 것입니다.

도움이되기를 바랍니다.

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

명령을 찾을 수 없으면 언제든지 랩핑 할 수 있습니다. System.speech.synthesis.speechsynthesizer .NET 3.0에서 ( "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);
        }
    }
}

PowerShell 방법도 있습니다.

speak.ps1이라는 파일을 만듭니다

param([string]$inputText)
Add-Type –AssemblyName System.Speech 
$synth = New-Object System.Speech.Synthesis.SpeechSynthesizer
$synth.Speak($inputText);

그럼 당신은 그것을 부를 수 있습니다

.\speak.ps1 "I'm sorry Dave, I'm afraid I can't do that"

가장 좋은 방법은 이를 수행할 작은 명령줄 유틸리티를 작성하는 것입니다.많은 작업이 필요하지 않습니다. 텍스트를 읽은 다음 ms tts 라이브러리를 사용하면 됩니다.

또 다른 대안은 다음을 사용하는 것입니다. 켑스트럴.멋진 명령줄 유틸리티가 함께 제공되며 ms tts보다 몇 년 더 나은 소리를 냅니다.

또한 있습니다 발라 볼카: 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"
    

더 많은 명령 줄 옵션을 사용할 수 있습니다. 와인에 SAPI5를 설치하여 Ubuntu에서 시도했습니다. 잘 작동합니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top