Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- Rem define initial variables
- set speaker=en-gb-southern_english_female-low.onnx
- set argum=%*
- Rem output folder:
- set place=r:\
- Rem check if the bat file was double clicked from the explorer:
- IF /I %0 EQU "%~dpnx0" (
- set argum=Please run this batch command from the commandline ! ? .
- echo Please run this batch command from the commandline !
- goto :continueloop
- )
- Rem check if the bat file has runned without parameters, and display the info:
- if "%1"=="" (
- echo.
- echo usage: say [voice:] text
- echo.
- echo Voices
- echo German: eva: kar: ker: pav: ram: tho:
- echo En-GB: ala: sen:
- Echo EN-US: amy: danny: kath: less: libri: ryanlow: ryanhi:
- echo.
- echo This needs the piper.exe and ffplay.exe to speak the words !
- echo The wav file is saved in the %place% folder, change it to the desired location!
- goto :theend
- )
- Rem assign voice definitions from %1:
- if "%1"=="eva:" (
- set speaker=de-eva_k-x-low.onnx
- goto :getloop
- )
- if "%1"=="kar:" (
- set speaker=de-karlsson-low.onnx
- goto :getloop
- )
- if "%1"=="ker:" (
- set speaker=de-kerstin-low.onnx
- goto :getloop
- )
- if "%1"=="pav:" (
- set speaker=de-pavoque-low.onnx
- goto :getloop
- )
- if "%1"=="ram:" (
- set speaker=de-ramona-low.onnx
- goto :getloop
- )
- if "%1"=="tho:" (
- set speaker=de-thorsten-low.onnx
- goto :getloop
- )
- if "%1"=="ala:" (
- set speaker=en-gb-alan-low.onnx
- goto :getloop
- )
- if "%1"=="sen:" (
- set speaker=en-gb-southern_english_female-low.onnx
- goto :getloop
- )
- if "%1"=="amy:" (
- set speaker=en-us-amy-low.onnx
- goto :getloop
- )
- if "%1"=="danny:" (
- set speaker=en-us-danny-low.onnx
- goto :getloop
- )
- if "%1"=="kath:" (
- set speaker=en-us-kathleen-low.onnx
- goto :getloop
- )
- if "%1"=="less:" (
- set speaker=en-us-lessac-low.onnx
- goto :getloop
- )
- if "%1"=="libri:" (
- set speaker=en-us-libritts-high.onnx
- goto :getloop
- )
- if "%1"=="ryanlow:" (
- set speaker=en-us-ryan-low.onnx
- goto :getloop
- )
- if "%1"=="ryanhi:" (
- set speaker=en-us-ryan-high.onnx
- goto :getloop
- )
- Rem Create the wav file with the piper.exe
- :continueloop
- echo.
- echo ? . %argum% . . . | piper.exe -q -m %speaker% -f %place%speakingoutput.wav
- rem and play it with the ffplay.exe, replace it with a player of your choice:
- ffplay -hide_banner -loglevel panic -nodisp -autoexit %place%speakingoutput.wav
- goto :theend
- Rem remove the first parameter (voice name) and assing the rest into argum variable
- :getloop
- for /f "tokens=1,* delims= " %%a in ("%*") do set argum=%%b
- goto :continueloop
- Rem end the batch file
- :theend
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement