1#!/bin/sh
2####################################################-*-mode:shell-script-*-
3##                                                                       ##
4##                   Carnegie Mellon University and                      ##
5##                   Alan W Black and Kevin A. Lenzo                     ##
6##                      Copyright (c) 1998-2000                          ##
7##                        All Rights Reserved.                           ##
8##                                                                       ##
9##  Permission is hereby granted, free of charge, to use and distribute  ##
10##  this software and its documentation without restriction, including   ##
11##  without limitation the rights to use, copy, modify, merge, publish,  ##
12##  distribute, sublicense, and/or sell copies of this work, and to      ##
13##  permit persons to whom this work is furnished to do so, subject to   ##
14##  the following conditions:                                            ##
15##   1. The code must retain the above copyright notice, this list of    ##
16##      conditions and the following disclaimer.                         ##
17##   2. Any modifications must be clearly marked as such.                ##
18##   3. Original authors' names are not deleted.                         ##
19##   4. The authors' names are not used to endorse or promote products   ##
20##      derived from this software without specific prior written        ##
21##      permission.                                                      ##
22##                                                                       ##
23##  CARNEGIE MELLON UNIVERSITY AND THE CONTRIBUTORS TO THIS WORK         ##
24##  DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING      ##
25##  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT   ##
26##  SHALL CARNEGIE MELLON UNIVERSITY NOR THE CONTRIBUTORS BE LIABLE      ##
27##  FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES    ##
28##  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN   ##
29##  AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,          ##
30##  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF       ##
31##  THIS SOFTWARE.                                                       ##
32##                                                                       ##
33###########################################################################
34
35if [ ! "$ESTDIR" ]
36then
37   echo "environment variable ESTDIR is unset"
38   echo "set it to your local speech tools directory e.g."
39   echo '   bash$ export ESTDIR=/home/awb/projects/speech_tools/'
40   echo or
41   echo '   csh% setenv ESTDIR /home/awb/projects/speech_tools/'
42   exit 1
43fi
44
45if [ ! "$FESTVOXDIR" ]
46then
47   echo "environment variable FESTVOXDIR is unset"
48   echo "set it to your local festvox directory e.g."
49   echo '   bash$ export FESTVOXDIR=/home/awb/projects/festvox/'
50   echo or
51   echo '   csh% setenv FESTVOXDIR /home/awb/projects/festvox/'
52   exit 1
53fi
54
55F0MIN=50
56F0MAX=200
57F0MEAN=110
58if [ -f etc/f0.params ]
59then
60   . etc/f0.params
61fi
62
63F0_ARGS=`echo $F0MIN $F0MAX $F0MEAN | awk '{printf("-min %f -max %f -def %f",1.0/$2,1.0/$1,1.0/$3)}'`
64
65PM_ARGS='-wave_end -lx_lf 140 -lx_lo 111 -lx_hf 80 -lx_ho 51 -med_o 0'
66
67# Old values
68#MALE_PM_ARGS='-min 0.0057 -max 0.012 -def 0.01 -wave_end -lx_lf 140 -lx_lo 111 -lx_hf 80 -lx_ho 51 -med_o 0'
69#FEMALE_PM_ARGS='-min 0.00333 -max 0.0075 -def 0.006 -wave_end -lx_lf 140 -lx_lo 111 -lx_hf 80 -lx_ho 51 -med_o 0'
70
71if [ ! -f etc/silence ]
72then
73   $ESTDIR/../festival/bin/festival -b festvox/build_clunits.scm "(find_silence_name)"
74fi
75SILENCE=`awk '{print $1}' etc/silence`
76
77PROMPTFILE=etc/txt.done.data
78if [ $# = 1 ]
79then
80   PROMPTFILE=$1
81fi
82
83awk '{print $2}' $PROMPTFILE |
84while read i
85do
86  fname=$i
87  echo $fname F0_PM
88
89  $ESTDIR/bin/ch_wave -scaleN 0.9 wav/$fname.wav -F 16000 |
90  $ESTDIR/bin/pitchmark -o pm_unfilled/$fname.pm -otype est $PM_ARGS $F0_ARGS
91
92  $FESTVOXDIR/src/general/smooth_f0 -o f0/$fname.f0 -pm_input -pm_min_f0 70 -otype ssff pm_unfilled/$fname.pm -lab lab/$fname.lab -silences $SILENCE -interpolate -postsmooth -postwindow 0.025
93done
94
95
96