diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-09-02 22:32:34 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-09-02 22:32:34 +0000 |
commit | 5dbea469a6b476d338353c46473ba9bd3ef0bcb5 (patch) | |
tree | 3418fa11ec37dc9bc20827f8531c9bd500c17b5c /tools/sapi5_voice_new.vbs | |
parent | 09d66ac4567936ff2c797d7ea0e7f61ad43264fc (diff) | |
download | rockbox-5dbea469a6b476d338353c46473ba9bd3ef0bcb5.tar.gz rockbox-5dbea469a6b476d338353c46473ba9bd3ef0bcb5.zip |
SAPI voice file generation: * Added language matching and voice selection (use TTS option /voice:<name> to select; voices with spaces in the name need the options quotes). * Added SAPI4 support (use TTS option /sapi4; voice file generation takes hours...)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14587 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/sapi5_voice_new.vbs')
-rwxr-xr-x | tools/sapi5_voice_new.vbs | 94 |
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 | |||
24 | Option Explicit | ||
25 | |||
26 | Const SSFMCreateForWrite = 3 | ||
27 | |||
28 | ' Audio formats for SAPI5 filestream object | ||
29 | Const SPSF_8kHz16BitMono = 6 | ||
30 | Const SPSF_11kHz16BitMono = 10 | ||
31 | Const SPSF_12kHz16BitMono = 14 | ||
32 | Const SPSF_16kHz16BitMono = 18 | ||
33 | Const SPSF_22kHz16BitMono = 22 | ||
34 | Const SPSF_24kHz16BitMono = 26 | ||
35 | Const SPSF_32kHz16BitMono = 30 | ||
36 | Const SPSF_44kHz16BitMono = 34 | ||
37 | Const SPSF_48kHz16BitMono = 38 | ||
38 | |||
39 | Dim oShell, oEnv | ||
40 | Dim oSpVoice, oSpFS ' SAPI5 voice and filestream | ||
41 | Dim aLine, aData ' used in command reading | ||
42 | Dim nAudioFormat | ||
43 | Dim bVerbose | ||
44 | |||
45 | |||
46 | On Error Resume Next | ||
47 | |||
48 | nAudioFormat = 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 | |||
52 | Set oShell = CreateObject("WScript.Shell") | ||
53 | Set oEnv = oShell.Environment("Process") | ||
54 | bVerbose = (oEnv("V") <> "") | ||
55 | |||
56 | Set oSpVoice = CreateObject("SAPI.SpVoice") | ||
57 | If 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 | ||
62 | End If | ||
63 | |||
64 | Set oSpFS = CreateObject("SAPI.SpFileStream") | ||
65 | oSpFS.Format.Type = nAudioFormat | ||
66 | |||
67 | On Error Goto 0 | ||
68 | |||
69 | Do | ||
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 | ||
94 | Loop | ||