Index: configure =================================================================== --- configure (revision 14407) +++ configure (working copy) @@ -351,7 +351,7 @@ DEFAULT_NOISEFLOOR="500" DEFAULT_CHOICE="F" fi - # Allow SAPI if Windows is in use + # Allow SAPI (4 and 5) if Windows is in use if [ -f "`which winver`" ]; then SAPI5="(S)API5 " SAPI5_OPTS="SAPI5_OPTS=\"\"" @@ -359,14 +359,17 @@ DEFAULT_TTS_OPTS=$SAPI5_OPTS DEFAULT_NOISEFLOOR="500" DEFAULT_CHOICE="S" + + SAPI4="SAPI(4) " + SAPI4_OPTS="SAPI4_OPTS=\"\"" fi if [ "$FESTIVAL" = "$FLITE" ] && [ "$FLITE" = "$ESPEAK" ] && [ "$ESPEAK" = "$SAPI5" ]; then - echo "You need Festival, eSpeak or Flite in your path, or SAPI5 available to build voice files" + echo "You need Festival, eSpeak or Flite in your path, or SAPI (4 or 5) available to build voice files" exit fi - echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI5}(${DEFAULT_CHOICE})?" + echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI5}${SAPI4}(${DEFAULT_CHOICE})?" option=`input` case "$option" in [Ll]) @@ -389,6 +392,11 @@ NOISEFLOOR="500" TTS_OPTS=$SAPI5_OPTS ;; + [4]) + TTS_ENGINE="sapi4" + NOISEFLOOR="500" + TTS_OPTS=$SAPI4_OPTS + ;; *) TTS_ENGINE=$DEFAULT_TTS TTS_OPTS=$DEFAULT_TTS_OPTS Index: voicecommon.sh =================================================================== --- voicecommon.sh (revision 14407) +++ voicecommon.sh (working copy) @@ -52,9 +52,9 @@ # The wavtrim executable WAVTRIM=$TOOLSDIR/wavtrim -# The SAPI5 script directory +# The SAPI script directory if [ -f "`which cygpath`" ]; then - SAPI5DIR=`cygpath $TOOLSDIR -a -w` + SAPIDIR=`cygpath $TOOLSDIR -a -w` fi ##################### @@ -174,12 +174,15 @@ ;; sapi5) # Check for SAPI5 - cscript /B $SAPI5DIR/sapi5_init_tts.vbs + cscript /B $SAPIDIR/sapi5_init_tts.vbs if [ $? -ne 0 ]; then echo "Error: SAPI 5 not available" exit 5 fi ;; + sapi4) + # xxx: Add check for SAPI4 + ;; *) echo "Error: no valid TTS engine selected: $TTS_ENGINE" exit 2 @@ -285,8 +288,11 @@ echo -E "$TO_SPEAK" | $FLITE_BIN $FLITE_OPTS -o "$WAV_FILE" ;; sapi5) - cscript /B "$SAPI5DIR\sapi5_voice.vbs" ""$TO_SPEAK"" "$WAV_FILE" + cscript /B "$SAPIDIR\sapi5_voice.vbs" ""$TO_SPEAK"" "$WAV_FILE" ;; + sapi4) + cscript /B "$SAPIDIR\sapi4_voice.vbs" ""$TO_SPEAK"" "$WAV_FILE" + ;; esac fi fi Index: sapi4_voice.vbs =================================================================== --- sapi4_voice.vbs (revision 0) +++ sapi4_voice.vbs (revision 0) @@ -0,0 +1,88 @@ +'*************************************************************************** +' __________ __ ___. +' Open \______ \ ____ ____ | | _\_ |__ _______ ___ +' Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +' Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +' Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +' \/ \/ \/ \/ \/ +' $Id: sapi5_voice.vbs$ +' +' Copyright (C) 2007 Steve Bavin, Jens Arnold, Mesar Hameed +' +' All files in this archive are subject to the GNU General Public License. +' See the file COPYING in the source tree root for full license agreement. +' +' This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +' KIND, either express or implied. +' +'*************************************************************************** +' Purpose: Make a voice clip file for the given text +' Parameters: $0 - text to convert +' $1 - file to write spoken text into (WAV format) + + + +'To be done: +' - Somehow, persist oSpVoice across multiple clips to increase speed +' - Allow user to override voice, speed and/or format (currently uses Control Panel defaults for voice/speed) +' - Voice specific replacements/corrections for pronounciation (this should be at a higher level really) + +Const SSFMCreateForWrite = 3 + +Const SPSF_8kHz16BitMono = 6 +Const SPSF_11kHz16BitMono = 10 +Const SPSF_12kHz16BitMono = 14 +Const SPSF_16kHz16BitMono = 18 +Const SPSF_22kHz16BitMono = 22 +Const SPSF_24kHz16BitMono = 26 +Const SPSF_32kHz16BitMono = 30 +Const SPSF_44kHz16BitMono = 34 +Const SPSF_48kHz16BitMono = 38 + +Dim oSpVoice, oSpFS, nAudioFormat, sText, sOutputFile + +sText = Replace(WScript.Arguments(0), "\", "") +sOutputFile = WScript.Arguments(1) +nAudioFormat = SPSF_22kHz16BitMono 'Audio format to use, recommended settings: + '- for AT&T natural voices, use SPSF_32kHz16BitMono + '- for MS voices, use SPSF_22kHz16BitMono +DIM BDone +DIM Nmode + + +set OSPVoice = WScript.CreateObject("ActiveVoice.ActiveVoice", "TTS_") +OspVoice.Initialized = 1 + OspVoice.CallbacksEnabled = 1 + OSPVoice.Select 1 +OSPVoice.Filename = sOutputFile +BDone =False + +if len(SText) <1 then +'Do nothing +BDone =True + +end if + + +OSPVoice.Speed =395 + +OspVoice.Speak SText + +while not BDone +wscript.sleep 5 + + +wend + + +'OSPVoice.Filename ="" +wscript.sleep 10 + +Set oArgs = Nothing + +WScript.Quit 0 + +Sub TTS_AudioStop(hi, lo) + + bDone = True +End Sub