summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xtools/configure28
-rwxr-xr-xtools/sapi5_init_tts.vbs29
-rwxr-xr-xtools/sapi5_stop_tts.vbs18
-rwxr-xr-xtools/sapi5_voice.vbs68
-rw-r--r--tools/voicecommon.sh21
5 files changed, 157 insertions, 7 deletions
diff --git a/tools/configure b/tools/configure
index b2d2be2508..e01230c390 100755
--- a/tools/configure
+++ b/tools/configure
@@ -326,19 +326,28 @@ voiceconfig () {
326 fi 326 fi
327 if [ `which festival` ]; then 327 if [ `which festival` ]; then
328 FESTIVAL="(F)estival " 328 FESTIVAL="(F)estival "
329 FESTIVAL_OPTS="FLITE_OPTS=\"\"" 329 FESTIVAL_OPTS="FESTIVAL_OPTS=\"\""
330 DEFAULT_TTS="festival" 330 DEFAULT_TTS="festival"
331 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS 331 DEFAULT_TTS_OPTS=$FESTIVAL_OPTS
332 DEFAULT_NOISEFLOOR="500" 332 DEFAULT_NOISEFLOOR="500"
333 DEFAULT_CHOICE="F" 333 DEFAULT_CHOICE="F"
334 fi 334 fi
335 # Allow SAPI if Windows is in use
336 if [ `which winver` ]; then
337 SAPI5="(S)API5 "
338 SAPI5_OPTS="SAPI5_OPTS=\"\""
339 DEFAULT_TTS="sapi5"
340 DEFAULT_TTS_OPTS=$SAPI5_OPTS
341 DEFAULT_NOISEFLOOR="500"
342 DEFAULT_CHOICE="S"
343 fi
335 344
336 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ]; then 345 if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI5" ]; then
337 echo "You need Festival, eSpeak or Flite in your path to build voice files" 346 echo "You need Festival, eSpeak or Flite in your path, or SAPI5 available to build voice files"
338 exit 347 exit
339 fi 348 fi
340 349
341 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}(${DEFAULT_CHOICE})?" 350 echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI5}(${DEFAULT_CHOICE})?"
342 option=`input` 351 option=`input`
343 case "$option" in 352 case "$option" in
344 [Ll]) 353 [Ll])
@@ -356,6 +365,11 @@ voiceconfig () {
356 NOISEFLOOR="500" 365 NOISEFLOOR="500"
357 TTS_OPTS=$FESTIVAL_OPTS 366 TTS_OPTS=$FESTIVAL_OPTS
358 ;; 367 ;;
368 [Ss])
369 TTS_ENGINE="sapi5"
370 NOISEFLOOR="500"
371 TTS_OPTS=$SAPI5_OPTS
372 ;;
359 *) 373 *)
360 TTS_ENGINE=$DEFAULT_TTS 374 TTS_ENGINE=$DEFAULT_TTS
361 TTS_OPTS=$DEFAULT_TTS_OPTS 375 TTS_OPTS=$DEFAULT_TTS_OPTS
@@ -413,11 +427,15 @@ voiceconfig () {
413# ENC_OPTS=$DEFAULT_ENC_OPTS 427# ENC_OPTS=$DEFAULT_ENC_OPTS
414# esac 428# esac
415 echo "Using $ENCODER for encoding voice clips" 429 echo "Using $ENCODER for encoding voice clips"
430 TEMPDIR="${pwd}"
431 if [ `which cygpath` ]; then
432 TEMPDIR=`cygpath . -a -w`
433 fi
416 434
417 cat > voicesettings.sh <<EOF 435 cat > voicesettings.sh <<EOF
418TTS_ENGINE="${TTS_ENGINE}" 436TTS_ENGINE="${TTS_ENGINE}"
419ENCODER="${ENCODER}" 437ENCODER="${ENCODER}"
420TEMPDIR="${pwd}" 438TEMPDIR="$TEMPDIR"
421NOISEFLOOR="${NOISEFLOOR}" 439NOISEFLOOR="${NOISEFLOOR}"
422${TTS_OPTS} 440${TTS_OPTS}
423${ENC_OPTS} 441${ENC_OPTS}
diff --git a/tools/sapi5_init_tts.vbs b/tools/sapi5_init_tts.vbs
new file mode 100755
index 0000000000..466ee5ce71
--- /dev/null
+++ b/tools/sapi5_init_tts.vbs
@@ -0,0 +1,29 @@
1'***************************************************************************
2' __________ __ ___.
3' Open \______ \ ____ ____ | | _\_ |__ _______ ___
4' Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5' Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6' Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7' \/ \/ \/ \/ \/
8' $Id: sapi5_init_tts.vbs$
9'
10' Copyright (C) 2007 Steve Bavin, Jens Arnold, Mesar Hameed
11'
12' All files in this archive are subject to the GNU General Public License.
13' See the file COPYING in the source tree root for full license agreement.
14'
15' This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16' KIND, either express or implied.
17'
18'***************************************************************************
19Dim oSpVoice, sVoice
20
21Set oSpVoice = CreateObject("SAPI.SpVoice")
22If Err.Number <> 0 Then
23 WScript.Echo "Error - could not get SpVoice object. " & _
24 "SAPI 5 not installed?"
25 Err.Clear
26 WScript.Quit 1
27End If
28
29WScript.Quit 0
diff --git a/tools/sapi5_stop_tts.vbs b/tools/sapi5_stop_tts.vbs
new file mode 100755
index 0000000000..eee149bf08
--- /dev/null
+++ b/tools/sapi5_stop_tts.vbs
@@ -0,0 +1,18 @@
1'***************************************************************************
2' __________ __ ___.
3' Open \______ \ ____ ____ | | _\_ |__ _______ ___
4' Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5' Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6' Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7' \/ \/ \/ \/ \/
8' $Id: sapi5_stop_tts.vbs$
9'
10' Copyright (C) 2007 Steve Bavin, Jens Arnold, Mesar Hameed
11'
12' All files in this archive are subject to the GNU General Public License.
13' See the file COPYING in the source tree root for full license agreement.
14'
15' This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16' KIND, either express or implied.
17'
18'***************************************************************************
diff --git a/tools/sapi5_voice.vbs b/tools/sapi5_voice.vbs
new file mode 100755
index 0000000000..c37836afb4
--- /dev/null
+++ b/tools/sapi5_voice.vbs
@@ -0,0 +1,68 @@
1'***************************************************************************
2' __________ __ ___.
3' Open \______ \ ____ ____ | | _\_ |__ _______ ___
4' Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5' Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6' Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7' \/ \/ \/ \/ \/
8' $Id: sapi5_voice.vbs$
9'
10' Copyright (C) 2007 Steve Bavin, Jens Arnold, Mesar Hameed
11'
12' All files in this archive are subject to the GNU General Public License.
13' See the file COPYING in the source tree root for full license agreement.
14'
15' This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16' KIND, either express or implied.
17'
18'***************************************************************************
19' Purpose: Make a voice clip file for the given text
20' Parameters: $0 - text to convert
21' $1 - file to write spoken text into (WAV format)
22
23
24
25'To be done:
26' - Somehow, persist oSpVoice across multiple clips to increase speed
27' - Allow user to override voice, speed and/or format (currently uses Control Panel defaults for voice/speed)
28' - Voice specific replacements/corrections for pronounciation (this should be at a higher level really)
29
30Const SSFMCreateForWrite = 3
31
32Const SPSF_8kHz16BitMono = 6
33Const SPSF_11kHz16BitMono = 10
34Const SPSF_12kHz16BitMono = 14
35Const SPSF_16kHz16BitMono = 18
36Const SPSF_22kHz16BitMono = 22
37Const SPSF_24kHz16BitMono = 26
38Const SPSF_32kHz16BitMono = 30
39Const SPSF_44kHz16BitMono = 34
40Const SPSF_48kHz16BitMono = 38
41
42Dim oSpVoice, oSpFS, nAudioFormat, sText, sOutputFile
43
44sText = Replace(WScript.Arguments(0), "\", "")
45sOutputFile = WScript.Arguments(1)
46nAudioFormat = SPSF_22kHz16BitMono 'Audio format to use, recommended settings:
47 '- for AT&T natural voices, use SPSF_32kHz16BitMono
48 '- for MS voices, use SPSF_22kHz16BitMono
49
50Set oSpVoice = CreateObject("SAPI.SpVoice")
51If Err.Number <> 0 Then
52 WScript.Echo "Error - could not get SpVoice object. " & _
53 "SAPI 5 not installed?"
54 Err.Clear
55 WScript.Quit 1
56End If
57
58Set oSpFS = CreateObject("SAPI.SpFileStream")
59oSpFS.Format.Type = nAudioFormat
60oSpFS.Open sOutputFile, SSFMCreateForWrite, False
61Set oSpVoice.AudioOutputStream = oSpFS
62oSpVoice.Speak sText
63oSpFS.Close
64
65Set oSpFS = Nothing
66Set oSpVoice = Nothing
67Set oArgs = Nothing
68WScript.Quit 0
diff --git a/tools/voicecommon.sh b/tools/voicecommon.sh
index 13df3e9739..138ff59a9e 100644
--- a/tools/voicecommon.sh
+++ b/tools/voicecommon.sh
@@ -46,8 +46,14 @@ SPEEX_BIN=speexenc
46# The oggenc executable 46# The oggenc executable
47VORBIS_BIN=oggenc 47VORBIS_BIN=oggenc
48 48
49# Tools directory
50TOOLSDIR=`dirname $0`
51
49# The wavtrim executable 52# The wavtrim executable
50WAVTRIM=`dirname $0`/wavtrim 53WAVTRIM=$TOOLSDIR/wavtrim
54
55# The SAPI5 script directory
56SAPI5DIR=`cygpath $TOOLSDIR -a -w`
51 57
52##################### 58#####################
53# Festival settings # 59# Festival settings #
@@ -158,12 +164,20 @@ init_tts() {
158 fi 164 fi
159 ;; 165 ;;
160 espeak) 166 espeak)
161 # Check for flite 167 # Check for espeak
162 if [ ! `which $ESPEAK_BIN` ]; then 168 if [ ! `which $ESPEAK_BIN` ]; then
163 echo "Error: $ESPEAK_BIN not found" 169 echo "Error: $ESPEAK_BIN not found"
164 exit 5 170 exit 5
165 fi 171 fi
166 ;; 172 ;;
173 sapi5)
174 # Check for SAPI5
175 cscript /B $SAPI5DIR/sapi5_init_tts.vbs
176 if [ $? -ne 0 ]; then
177 echo "Error: SAPI 5 not available"
178 exit 5
179 fi
180 ;;
167 *) 181 *)
168 echo "Error: no valid TTS engine selected: $TTS_ENGINE" 182 echo "Error: no valid TTS engine selected: $TTS_ENGINE"
169 exit 2 183 exit 2
@@ -268,6 +282,9 @@ voice() {
268 echo "Action: Generate $WAV_FILE with flite" 282 echo "Action: Generate $WAV_FILE with flite"
269 echo -E "$TO_SPEAK" | $FLITE_BIN $FLITE_OPTS -o "$WAV_FILE" 283 echo -E "$TO_SPEAK" | $FLITE_BIN $FLITE_OPTS -o "$WAV_FILE"
270 ;; 284 ;;
285 sapi5)
286 cscript /B "$SAPI5DIR\sapi5_voice.vbs" ""$TO_SPEAK"" "$WAV_FILE"
287 ;;
271 esac 288 esac
272 fi 289 fi
273 fi 290 fi