replace the old rbutil title icon with the logo-like icon (which is already used...
[Rockbox.git] / tools / sapi5_voice_new.vbs
blob96c6e2a720b8fd2378403e00849804f6124e3846
1 '***************************************************************************
2 ' __________ __ ___.
3 ' Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 ' Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 ' Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 ' Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 ' \/ \/ \/ \/ \/
8 ' $Id: sapi5_voice.vbs$
10 ' Copyright (C) 2007 Steve Bavin, Jens Arnold, Mesar Hameed
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.
15 ' This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 ' KIND, either express or implied.
18 '***************************************************************************
19 ' Purpose: Make a voice clip file for the given text on stdin
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)
25 Const SSFMCreateForWrite = 3
27 Const SPSF_8kHz16BitMono = 6
28 Const SPSF_11kHz16BitMono = 10
29 Const SPSF_12kHz16BitMono = 14
30 Const SPSF_16kHz16BitMono = 18
31 Const SPSF_22kHz16BitMono = 22
32 Const SPSF_24kHz16BitMono = 26
33 Const SPSF_32kHz16BitMono = 30
34 Const SPSF_44kHz16BitMono = 34
35 Const SPSF_48kHz16BitMono = 38
37 Dim oSpVoice, oSpFS, nAudioFormat, sText, sOutputFile
39 nAudioFormat = SPSF_22kHz16BitMono 'Audio format to use, recommended settings:
40 '- for AT&T natural voices, use SPSF_32kHz16BitMono
41 '- for MS voices, use SPSF_22kHz16BitMono
43 Set oSpVoice = CreateObject("SAPI.SpVoice")
44 If 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
49 End If
51 While 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
67 Wend