File: benchmark

package info (click to toggle)
festival 1%3A2.4~release-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 7,432 kB
  • ctags: 6,364
  • sloc: cpp: 27,729; lisp: 15,695; ansic: 6,022; sh: 5,660; java: 1,536; makefile: 769; xml: 291; perl: 87
file content (100 lines) | stat: -rwxr-xr-x 1,815 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/bin/sh

default_libdir="/usr/lib/festival"
default_datadir="/usr/share/festival"

while true
	do
	case "$1" in
	-f ) festival="${2}"
		shift 2
		;;
	-l ) libdir="$2"
		shift 2
		;;
	-d ) datadir="$2"
		shift 2
		;;
	-- ) shift; break ;;
	* ) break;;
	esac
done

text=${1-"/usr/share/doc/festival/examples/benchmark.text"}

for i in /usr/bin . src/main ../src/main $HOME/projects/festival/src/main /cstr/bin
	do
	if [ -n "$festival" ]
		then
		break;
	fi
	if [ -x "$i/festival" ]
		then
		festival="$i/festival"
	fi
done

[ -n "$festival" ] ||
	{
	echo "Can't find festival"
	exit 1
	}

if [ -z "$libdir" ]
	then
	case $festival in 
	*main/festival )	libdir=`dirname $festival`/../../lib;;
	* ) libdir=$default_libdir;
	esac
fi

if [ -z "$datadir" ]
	then
	case $festival in 
	*main/festival )   datadir=`dirname $festival`/../../share;;
	* ) datadir=$default_datadir;;
	esac
fi

echo Using $festival

start_flag_file="/tmp/fest_start_$$"
end_flag_file="/tmp/fest_end_$$"
script="/tmp/fest_script_$$"

echo -n > $flag_file;

cat > $script <<__END__

(set! libdir "$libdir/")
(set! datadir "$datadir/")
(set! lexdir "$default_datadir/dicts/")
(set! voiced_dir "$default_datadir/voices/")

(load (string-append datadir "init.scm"))
(if (probe_file (format nil "%s/.festivalrc" (getenv "HOME")))
    (load (format nil "%s/.festivalrc" (getenv "HOME"))))


(audio_mode 'async)
(set! tts_hooks (list utt.synth))

(puts "start...\n" nil)
(fclose (fopen "$start_flag_file" "w"))

(tts_file "$text" (quote text))

(fclose (fopen "$end_flag_file" "w"))
(puts "...end\n" nil)
(audio_mode 'close)

(quit)

__END__

eval $festival --script $script

perl -e 'print "running time = ", (stat($ARGV[1]))[8]-(stat($ARGV[0]))[8], " seconds\n";' $start_flag_file $end_flag_file

/bin/rm -f $start_flag_file $end_flag_file $script