summaryrefslogtreecommitdiff
path: root/tools/sapi5_voice_new.vbs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sapi5_voice_new.vbs')
-rwxr-xr-xtools/sapi5_voice_new.vbs67
1 files changed, 67 insertions, 0 deletions
diff --git a/tools/sapi5_voice_new.vbs b/tools/sapi5_voice_new.vbs
new file mode 100755
index 0000000000..96c6e2a720
--- /dev/null
+++ b/tools/sapi5_voice_new.vbs
@@ -0,0 +1,67 @@
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 on stdin
20
21'To be done:
22' - Allow user to override voice, speed and/or format (currently uses Control Panel defaults for voice/speed)
23' - Voice specific replacements/corrections for pronounciation (this should be at a higher level really)
24
25Const SSFMCreateForWrite = 3
26
27Const SPSF_8kHz16BitMono = 6
28Const SPSF_11kHz16BitMono = 10
29Const SPSF_12kHz16BitMono = 14
30Const SPSF_16kHz16BitMono = 18
31Const SPSF_22kHz16BitMono = 22
32Const SPSF_24kHz16BitMono = 26
33Const SPSF_32kHz16BitMono = 30
34Const SPSF_44kHz16BitMono = 34
35Const SPSF_48kHz16BitMono = 38
36
37Dim oSpVoice, oSpFS, nAudioFormat, sText, sOutputFile
38
39nAudioFormat = SPSF_22kHz16BitMono 'Audio format to use, recommended settings:
40'- for AT&T natural voices, use SPSF_32kHz16BitMono
41'- for MS voices, use SPSF_22kHz16BitMono
42
43Set oSpVoice = CreateObject("SAPI.SpVoice")
44If Err.Number <> 0 Then
45 WScript.Echo "Error - could not get SpVoice object. " & _
46 "SAPI 5 not installed?"
47 Err.Clear
48 WScript.Quit 1
49End If
50
51While 1 > 0
52 sText = WScript.StdIn.ReadLine
53 sOutputFile = WScript.StdIn.ReadLine
54 If sOutputFile = "" Then
55 Set oSpFS = Nothing
56 Set oSpVoice = Nothing
57 Set oArgs = Nothing
58 WScript.Quit 0
59 End If
60 ' WScript.Echo "Saying " + sText + " in " + sOutputFile
61 Set oSpFS = CreateObject("SAPI.SpFileStream")
62 oSpFS.Format.Type = nAudioFormat
63 oSpFS.Open sOutputFile, SSFMCreateForWrite, False
64 Set oSpVoice.AudioOutputStream = oSpFS
65 oSpVoice.Speak sText
66 oSpFS.Close
67Wend