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.vbs94
1 files changed, 0 insertions, 94 deletions
diff --git a/tools/sapi5_voice_new.vbs b/tools/sapi5_voice_new.vbs
deleted file mode 100755
index f6abcf7d0b..0000000000
--- a/tools/sapi5_voice_new.vbs
+++ /dev/null
@@ -1,94 +0,0 @@
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
24Option Explicit
25
26Const SSFMCreateForWrite = 3
27
28' Audio formats for SAPI5 filestream object
29Const SPSF_8kHz16BitMono = 6
30Const SPSF_11kHz16BitMono = 10
31Const SPSF_12kHz16BitMono = 14
32Const SPSF_16kHz16BitMono = 18
33Const SPSF_22kHz16BitMono = 22
34Const SPSF_24kHz16BitMono = 26
35Const SPSF_32kHz16BitMono = 30
36Const SPSF_44kHz16BitMono = 34
37Const SPSF_48kHz16BitMono = 38
38
39Dim oShell, oEnv
40Dim oSpVoice, oSpFS ' SAPI5 voice and filestream
41Dim aLine, aData ' used in command reading
42Dim nAudioFormat
43Dim bVerbose
44
45
46On Error Resume Next
47
48nAudioFormat = SPSF_22kHz16BitMono 'Audio format to use, recommended settings:
49'- for AT&T natural voices, use SPSF_32kHz16BitMono
50'- for MS voices, use SPSF_22kHz16BitMono
51
52Set oShell = CreateObject("WScript.Shell")
53Set oEnv = oShell.Environment("Process")
54bVerbose = (oEnv("V") <> "")
55
56Set oSpVoice = CreateObject("SAPI.SpVoice")
57If Err.Number <> 0 Then
58 WScript.StdErr.WriteLine "Error - could not get SpVoice object. " & _
59 "SAPI 5 not installed?"
60 Err.Clear
61 WScript.Quit 1
62End If
63
64Set oSpFS = CreateObject("SAPI.SpFileStream")
65oSpFS.Format.Type = nAudioFormat
66
67On Error Goto 0
68
69Do
70 aLine = Split(WScript.StdIn.ReadLine, vbTab, 2)
71 If Err.Number <> 0 Then
72 WScript.StdErr.WriteLine "Error " & Err.Number & ": " & Err.Description
73 WScript.Quit 1
74 End If
75 Select Case aLine(0) ' command
76 Case "SPEAK"
77 aData = Split(aLine(1), vbTab, 2)
78 If bVerbose Then WScript.StdErr.WriteLine "Saying " & aData(1) _
79 & " in " & aData(0)
80 oSpFS.Open aData(0), SSFMCreateForWrite, false
81 Set oSpVoice.AudioOutputStream = oSpFS
82 oSpVoice.Speak aData(1)
83 oSpFS.Close
84 Case "EXEC"
85 If bVerbose Then WScript.StdErr.WriteLine "> " & aLine(1)
86 oShell.Run aLine(1), 0, true
87 Case "SYNC"
88 If bVerbose Then WScript.StdErr.WriteLine "Syncing"
89 WScript.StdOut.WriteLine aLine(1) ' Just echo what was passed
90 Case "QUIT"
91 If bVerbose Then WScript.StdErr.WriteLine "Quitting"
92 WScript.Quit 0
93 End Select
94Loop