Ticket #29388: open_jtalk_demo.diff
File open_jtalk_demo.diff, 2.3 KB (added by humem (humem), 14 years ago) |
---|
-
open_jtalk_demo
old new 1 1 #!/bin/bash 2 2 # Shell wrapper for Open JTalk. 3 3 4 VOICE_DIR=@voice_dir@5 DIC_DIR=@dic_dir@6 7 4 CMDNAME=`basename $0` 8 5 9 case $1 in 10 -h) echo "Usage: $CMDNAME [-h] [-i infile]" 1>&2 ; exit 0 ;; 11 -i) shift ;; 12 *) set -- /dev/stdin ;; 13 esac 6 usage() { 7 echo "Usage: $CMDNAME [-h|--help] [-i|--infile infile] \\" 8 echo " [-v|--voice nitech|mei] \\" 9 echo " [-t|--tone angry|bashful|happy|normal|sad] \\" 10 echo " [infile]" 11 exit 1 12 } 13 14 DIC_DIR=@prefix@/lib/open_jtalk/dic 15 16 VOICE_ROOT=@prefix@/lib/open_jtalk/voice 17 VOICE_NITECH="$VOICE_ROOT/nitech" 18 VOICE_MEI_BASE="$VOICE_ROOT/mei_" 19 VOICE_TONE=normal 20 VOICE_MEI="$VOICE_MEI_BASE$VOICE_TONE" 21 VOICE_DIR="$VOICE_MEI" 22 23 INFILE=/dev/stdin 24 25 while test -n "$1"; do 26 case "$1" in 27 -h|--help) usage ;; 28 -i|--infile) INFILE="$2"; shift 2 ;; 29 -v|--voice) [ "$2" == "nitech" ] && VOICE_DIR="$VOICE_NITECH"; shift 2 ;; 30 -t|--tone) VOICE_DIR="$VOICE_MEI_BASE$2"; shift 2 ;; 31 "") INFILE=/dev/stdin ;; 32 *) INFILE="$1"; shift ;; 33 esac 34 done 14 35 15 36 WAVFILE="/tmp/$CMDNAME-$$.wav" 16 37 17 38 while read LINE 18 39 do 19 echo $LINE | @prefix@/bin/iconv -t EUC-JP | @prefix@/bin/open_jtalk \ 40 echo $LINE | @prefix@/bin/iconv -t EUC-JP | \ 41 @prefix@/bin/open_jtalk -s 48000 -p 240 -a 0.55 \ 20 42 -td $VOICE_DIR/tree-dur.inf \ 21 43 -tf $VOICE_DIR/tree-lf0.inf \ 22 44 -tm $VOICE_DIR/tree-mgc.inf \ 45 -tl $VOICE_DIR/tree-lpf.inf \ 23 46 -md $VOICE_DIR/dur.pdf \ 24 47 -mf $VOICE_DIR/lf0.pdf \ 25 48 -mm $VOICE_DIR/mgc.pdf \ 49 -ml $VOICE_DIR/lpf.pdf \ 26 50 -df $VOICE_DIR/lf0.win1 \ 27 51 -df $VOICE_DIR/lf0.win2 \ 28 52 -df $VOICE_DIR/lf0.win3 \ 29 53 -dm $VOICE_DIR/mgc.win1 \ 30 54 -dm $VOICE_DIR/mgc.win2 \ 31 55 -dm $VOICE_DIR/mgc.win3 \ 56 -dl $VOICE_DIR/lpf.win1 \ 32 57 -cf $VOICE_DIR/gv-lf0.pdf \ 33 58 -cm $VOICE_DIR/gv-mgc.pdf \ 34 59 -ef $VOICE_DIR/tree-gv-lf0.inf \ … … 36 61 -k $VOICE_DIR/gv-switch.inf \ 37 62 -x $DIC_DIR \ 38 63 -ow $WAVFILE && afplay $WAVFILE 39 done < "$ 1"64 done < "$INFILE" 40 65 41 66 rm -f $WAVFILE 42 67 exit 0