diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-12-23 22:03:49 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-12-23 22:03:49 +0000 |
commit | 37aeb12cc99cc22f62c44d5b0adcae35d0c471d8 (patch) | |
tree | e6a69829f73a9ac284c64c21561580c3fa11c527 | |
parent | cab7c46091d7c9f9804abd9952b3c8b65653ff74 (diff) | |
download | rockbox-37aeb12cc99cc22f62c44d5b0adcae35d0c471d8.tar.gz rockbox-37aeb12cc99cc22f62c44d5b0adcae35d0c471d8.zip |
If the environment variable 'POOL' is set to a directory, this script will
then check if there's a previously generated mp3 file in it and if so, use
that instead of regenerating a new one. This should greately enhance
processing speed when many phrases are similar between targets and over time.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11835 a1c6a512-1295-4272-9138-f99709370657
-rwxr-xr-x | tools/genvoice.sh | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/tools/genvoice.sh b/tools/genvoice.sh index 5b667ea3ba..f32ab9476a 100755 --- a/tools/genvoice.sh +++ b/tools/genvoice.sh | |||
@@ -73,9 +73,31 @@ generateclips() { | |||
73 | # String | 73 | # String |
74 | STRING=`echo $line |cut -b 8-` | 74 | STRING=`echo $line |cut -b 8-` |
75 | 75 | ||
76 | # Now generate the file | 76 | if [ -n "$POOL" ]; then |
77 | voice "$STRING" "$TEMPDIR/$ID".wav | 77 | # we have a common pool of snippets, check that first |
78 | encode "$TEMPDIR/$ID".wav "$TEMPDIR/$ID".mp3 | 78 | # for available mp3 sounds, and if it is available copy |
79 | # (symlink!) it over | ||
80 | if [ -f "$POOL/$STRING.mp3" ]; then | ||
81 | echo "Re-using $ID from pool" | ||
82 | if [ ! -e "$TEMPDIR/$ID".mp3 ]; then | ||
83 | # only do this if not present | ||
84 | ln -s "$POOL/$STRING.mp3" "$TEMPDIR/$ID".mp3 | ||
85 | fi | ||
86 | fi | ||
87 | fi | ||
88 | |||
89 | # only make an mp3 if not already present | ||
90 | if [ ! -e "$TEMPDIR/$ID".mp3 ]; then | ||
91 | # Now generate the file | ||
92 | voice "$STRING" "$TEMPDIR/$ID".wav | ||
93 | if [ -n "$POOL" ]; then | ||
94 | # create it in the pool, symlink it back | ||
95 | encode "$TEMPDIR/$ID".wav "$POOL/$STRING".mp3 | ||
96 | ln -s "$POOL/$STRING.mp3" "$TEMPDIR/$ID".mp3 | ||
97 | else | ||
98 | encode "$TEMPDIR/$ID".wav "$TEMPDIR/$ID".mp3 | ||
99 | fi | ||
100 | fi | ||
79 | ;; | 101 | ;; |
80 | esac | 102 | esac |
81 | i=`expr $i + 1` | 103 | i=`expr $i + 1` |