Ticket #29075: open_jtalk_demo

File open_jtalk_demo, 1.0 KB (added by humem (humem), 13 years ago)
Line 
1#!/bin/bash
2# Shell wrapper for Open JTalk.
3
4VOICE_DIR=@voice_dir@
5DIC_DIR=@dic_dir@
6
7CMDNAME=`basename $0`
8
9case $1 in
10    -h) echo "Usage: $CMDNAME [-h] [-i infile]" 1>&2 ; exit 0 ;;
11    -i) shift ;;
12    *)  set -- /dev/stdin ;;
13esac
14
15WAVFILE="/tmp/$CMDNAME-$$.wav"
16
17while read LINE
18do
19    echo $LINE | iconv -t EUC-JP | open_jtalk \
20        -td $VOICE_DIR/tree-dur.inf \
21        -tf $VOICE_DIR/tree-lf0.inf \
22        -tm $VOICE_DIR/tree-mgc.inf \
23        -md $VOICE_DIR/dur.pdf \
24        -mf $VOICE_DIR/lf0.pdf \
25        -mm $VOICE_DIR/mgc.pdf \
26        -df $VOICE_DIR/lf0.win1 \
27        -df $VOICE_DIR/lf0.win2 \
28        -df $VOICE_DIR/lf0.win3 \
29        -dm $VOICE_DIR/mgc.win1 \
30        -dm $VOICE_DIR/mgc.win2 \
31        -dm $VOICE_DIR/mgc.win3 \
32        -cf $VOICE_DIR/gv-lf0.pdf \
33        -cm $VOICE_DIR/gv-mgc.pdf \
34        -ef $VOICE_DIR/tree-gv-lf0.inf \
35        -em $VOICE_DIR/tree-gv-mgc.inf \
36        -k  $VOICE_DIR/gv-switch.inf \
37        -x  $DIC_DIR \
38        -ow $WAVFILE && afplay $WAVFILE
39done < "$1"
40
41rm -f $WAVFILE
42exit 0