Created
January 25, 2012 08:23
-
-
Save naoh16/1675424 to your computer and use it in GitHub Desktop.
Wrapper script for Open JTalk (see also "openjtalk.conf")
This file contains hidden or 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 | |
# | |
# Open JTalk 実行のためのスクリプト | |
# | |
# Copyright (C) 2012 Sunao HARA, Shikano Lab., NAIST/JAPAN | |
# Last Modified: 2012/01/25 13:38:20. | |
# | |
VOICEID=$1 | |
SRC_TXT=$2 | |
SRC_BASE=${SRC_TXT%\.*} | |
DST_WAV=${3:-$SRC_BASE.wav} | |
PREFIX=/usr/local/OpenJTalk | |
OPENJTALK=${PREFIX}/bin/open_jtalk | |
DICDIR=${PREFIX}/dic | |
VOICEDIR=${PREFIX}/voice/${VOICEID} | |
CONFFILE=${VOICEDIR}/openjtalk.conf | |
TXT_FLTR="iconv -t euc-jp" | |
#WAVEPARAM="-s 48000 -p 240 -a 0.55" | |
#WAVEPARAM="-s 16000 -p 80 -a 0.42" | |
function usage { | |
[ "x$1" == "x" ] || echo 2>&1 $1 | |
echo 2>&1 "usage: $0 voice_id input_txt [output_wav]" | |
exit 1 | |
} | |
[ -f "$SRC_TXT" ] || usage 'Error: Input-file not found' | |
$TXT_FLTR < $SRC_TXT | eval $OPENJTALK -x $DICDIR \ | |
`sed -e 's/#.*$//' $CONFFILE` \ | |
-ow $DST_WAV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment