Last active
February 21, 2022 06:25
-
-
Save mohemohe/b86fe7c9637da73c8d9bacdd2c9983ac to your computer and use it in GitHub Desktop.
voiceroid_daemon say
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
BASE_URL=http://172.16.34.56:8080 | |
#===================================== | |
function _exit() { | |
exit 1 | |
} | |
trap '_exit' {1,2,3,15} | |
if [ -p /dev/stdin ]; then { | |
message=$(cat -) | |
} else { | |
message="$*" | |
} fi | |
while read line; do { | |
if [ "${line}" == "" ]; then { | |
sleep 0.3 | |
continue | |
} fi | |
echo "${line}" | |
curl -Ls \ | |
"${BASE_URL}/api/speechtext" \ | |
-X POST \ | |
-H "Content-type: application/json" \ | |
-d "{\"Text\": \"${line}\", \"Speaker\": {\"Speed\": 1.1, \"Emphasis\": 1.1}}" \ | |
| aplay - \ | |
&> /dev/null | |
sleep 0.3 | |
} done <<EOS | |
${message} | |
EOS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment