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  
    11#!/bin/bash
    22# Shell wrapper for Open JTalk.
    33
    4 VOICE_DIR=@voice_dir@
    5 DIC_DIR=@dic_dir@
    6 
    74CMDNAME=`basename $0`
    85
    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
     6usage() {
     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
     14DIC_DIR=@prefix@/lib/open_jtalk/dic
     15
     16VOICE_ROOT=@prefix@/lib/open_jtalk/voice
     17VOICE_NITECH="$VOICE_ROOT/nitech"
     18VOICE_MEI_BASE="$VOICE_ROOT/mei_"
     19VOICE_TONE=normal
     20VOICE_MEI="$VOICE_MEI_BASE$VOICE_TONE"
     21VOICE_DIR="$VOICE_MEI"
     22
     23INFILE=/dev/stdin
     24
     25while 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
     34done
    1435
    1536WAVFILE="/tmp/$CMDNAME-$$.wav"
    1637
    1738while read LINE
    1839do
    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 \
    2042        -td $VOICE_DIR/tree-dur.inf \
    2143        -tf $VOICE_DIR/tree-lf0.inf \
    2244        -tm $VOICE_DIR/tree-mgc.inf \
     45        -tl $VOICE_DIR/tree-lpf.inf \
    2346        -md $VOICE_DIR/dur.pdf \
    2447        -mf $VOICE_DIR/lf0.pdf \
    2548        -mm $VOICE_DIR/mgc.pdf \
     49        -ml $VOICE_DIR/lpf.pdf \
    2650        -df $VOICE_DIR/lf0.win1 \
    2751        -df $VOICE_DIR/lf0.win2 \
    2852        -df $VOICE_DIR/lf0.win3 \
    2953        -dm $VOICE_DIR/mgc.win1 \
    3054        -dm $VOICE_DIR/mgc.win2 \
    3155        -dm $VOICE_DIR/mgc.win3 \
     56        -dl $VOICE_DIR/lpf.win1 \
    3257        -cf $VOICE_DIR/gv-lf0.pdf \
    3358        -cm $VOICE_DIR/gv-mgc.pdf \
    3459        -ef $VOICE_DIR/tree-gv-lf0.inf \
     
    3661        -k  $VOICE_DIR/gv-switch.inf \
    3762        -x  $DIC_DIR \
    3863        -ow $WAVFILE && afplay $WAVFILE
    39 done < "$1"
     64done < "$INFILE"
    4065
    4166rm -f $WAVFILE
    4267exit 0