Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
Moderator: DosItHelp
-
- Posts: 118
- Joined: 02 Apr 2017 06:11
Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
Hi Guys! Today I'm gonna be posting one of my most glamorous creations "Speecher". Usually when you don't know how to pronounce any word, you go to Google, type that word and click the volume icon that appears with the meaning (At least that's what I do ) But what to do when you have no Internet connection?? Google won't help you then
That's where Speecher comes in, Speecher is basically a program which says what you write in to it. In technical words, it's a Text-to-Speech engine . Although you can use Speecher for other purposes too. It all depends on your intelligence .
About me:
I'm currently working on Batch Projects but I know Python, HTML and CSS too. I'm one on of the admins on thebateam.org. My next project is BatchStore which is basically an App Store in Batch. This was my first post on dostips.com.. Tell me how would you rate it on a scale of 1/10? Also some tips for writing posts on dostips would be very appreciated. What do you think of my program?
Download link:
http://www.mediafire.com/file/4tovbku6kcercc7/Speecher.rar
Thanks for your attention
Bye Bye!
That's where Speecher comes in, Speecher is basically a program which says what you write in to it. In technical words, it's a Text-to-Speech engine . Although you can use Speecher for other purposes too. It all depends on your intelligence .
About me:
I'm currently working on Batch Projects but I know Python, HTML and CSS too. I'm one on of the admins on thebateam.org. My next project is BatchStore which is basically an App Store in Batch. This was my first post on dostips.com.. Tell me how would you rate it on a scale of 1/10? Also some tips for writing posts on dostips would be very appreciated. What do you think of my program?
Download link:
http://www.mediafire.com/file/4tovbku6kcercc7/Speecher.rar
Thanks for your attention
Bye Bye!
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
So how exactly does this work? Batch file never had direct access to anything that could produce sound other than the speaker (BEEP command).
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
Samir wrote:So how exactly does this work? Batch file never had direct access to anything that could produce sound other than the speaker (BEEP command).
I haven't actually downloaded it yet, but I'm betting it's a batch/vbscript hybrid.
EDIT: Yep, VBScript and BatBox.
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
It's a bit over-complicated for my taste, especially when you can just make a batch/vbscript hybrid script and get the same end result, but for people who don't know how to run things without clicking buttons, I guess this is nice. I'm still unclear about why you have to hit enter before you can click the button, and it would be nice if there was a way to close the program without just closing the window.
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
It uses the SpVoice Interface that you can access via ActiveX (e.g. using JScript or in this case VBScript).
Simplified JS hybrid:
Steffen
Simplified JS hybrid:
Code: Select all
@if (@a)==(@b) @end /* Batch part:
@echo off
cscript //nologo //e:jscript "%~f0" "Hello, world!"
exit /b &rem JScript part: */
WScript.CreateObject('SAPI.SpVoice').Speak(WScript.Arguments(0));
Steffen
-
- Posts: 118
- Joined: 02 Apr 2017 06:11
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
ShadowThief wrote:It's a bit over-complicated for my taste, especially when you can just make a batch/vbscript hybrid script and get the same end result, but for people who don't know how to run things without clicking buttons, I guess this is nice. I'm still unclear about why you have to hit enter before you can click the button, and it would be nice if there was a way to close the program without just closing the window.
Thnx for your suggestion ShadowThief, the reason you have to hit enter before you can click the "GO" button is because of the set /p command which requires pressing enter for the user input to be taken into the program. However, I'll fix this in the next version. Currently, I'm working on another project so the next version won't be coming out that much soon.
-
- Posts: 118
- Joined: 02 Apr 2017 06:11
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
aGerman wrote:It uses the SpVoice Interface that you can access via ActiveX (e.g. using JScript or in this case VBScript).
Simplified JS hybrid:Code: Select all
@if (@a)==(@b) @end /* Batch part:
@echo off
cscript //nologo //e:jscript "%~f0" "Hello, world!"
exit /b &rem JScript part: */
WScript.CreateObject('SAPI.SpVoice').Speak(WScript.Arguments(0));
Steffen
The problem is I don't know JS. I only know a bit of VBScript and a few other languages like Python,HTML and CSS.
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
It's actually not a matter of JScript. The only advantage is that you can combine it with the batch code in the same .bat file (as shown above).
You could also write the the line as VBScript in a manner that you can reuse it without writing it new all the time. All you have to do is passing the text to the script. WScript.Arguments(0) represents the first argument in every language that runs in wscrip.exe or cscript.exe (such as VBS and JS). E.g.
DataSpeecher.vbs
Example.bat
That's it. I'm quite sure you can change your tool in order to work accordingly
Steffen
You could also write the the line as VBScript in a manner that you can reuse it without writing it new all the time. All you have to do is passing the text to the script. WScript.Arguments(0) represents the first argument in every language that runs in wscrip.exe or cscript.exe (such as VBS and JS). E.g.
DataSpeecher.vbs
Code: Select all
CreateObject("SAPI.SpVoice").Speak WScript.Arguments(0)
Example.bat
Code: Select all
@echo off &setlocal
set "speech=Hello, World!"
start "" "DataSpeecher.vbs" "%speech%"
That's it. I'm quite sure you can change your tool in order to work accordingly
Steffen
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
I wrote this program some time ago:
Antonio
Code: Select all
@if (@CodeSection == @Batch) @then
@echo off
for %%a in ("Twinkle twinkle little star"
"HowÿI wonder whatÿyou are"
"Upÿa boveÿthe worldÿso high"
"Likeÿa diamond inÿthe sky"
"Twinkle twinkle little star"
"HowÿI wonder whatÿyou are") do (
CScript //nologo //E:JScript "%~F0" "%%~a"
)
goto :EOF
@end
// JScript section
var sapi = WScript.CreateObject("SAPI.SpVoice"),
word = WScript.Arguments(0).split(" ");
// Select the last available voice
// (to select an English voice in my Spanish computer)
// Remove this part for native English voices
var v = new Enumerator(sapi.GetVoices());
while ( ! v.atEnd() ) {
var voice = v.item();
v.moveNext();
}
sapi.Voice = voice;
// Show and speech the line word-by-word
for ( var i = 0; i < word.length; i++ ) {
WScript.Stdout.Write(word[i]+" ");
sapi.Speak(word[i]);
}
WScript.Stdout.WriteLine();
Antonio
-
- Expert
- Posts: 960
- Joined: 15 Jun 2012 13:16
- Location: Italy, Rome
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
with mshta:
Code: Select all
@echo off
set /p "to_say=enter a text :"
mshta "javascript:code(close((V=(v=new ActiveXObject('SAPI.SpVoice')).GetVoices()).count&&v.Speak('%to_say%')))"
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
"Twinkle.txt":
Apply aGerman batch/javascript hybrid :
"talk.bat"
Code: Select all
Twinkle twinkle little star.
How I wonder what you are.
Up above the world so high,
Like a diamond in the sky.
Twinkle twinkle little star.
How I wonder what you are.
Apply aGerman batch/javascript hybrid :
"talk.bat"
Code: Select all
@if (@a)==(@b) @end /* Batch part:
@echo off
for /f "tokens=*" %%A in (twinkle.txt) do (
echo %%A
call :sapi "%%A"
)
exit /b
:sapi
cscript //nologo //e:jscript "%~f0" "%~1"
goto :eof
exit /b &rem JScript part: */
WScript.CreateObject('SAPI.SpVoice').Speak(WScript.Arguments(0));
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
You could also modify emphasize, volume, and ... , see:
http://www.dostips.com/forum/viewtopic.php?p=34981#p34981
penpen
http://www.dostips.com/forum/viewtopic.php?p=34981#p34981
penpen
-
- Posts: 118
- Joined: 02 Apr 2017 06:11
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
Thank you so much for all your suggestions guys. I'll make sure to apply all of them in the next ver of Speecher after I finish my current project. I never thought Batch Legends with the likes of Aacini, aGerman,einstein1969 etc. will see my program. Thanks to all of you guys. Also be sure to check out my website thebateam.org. I think all Batch Programmers will like it alot
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
Also be sure to check out my website thebateam.org.
Yeah I already did. I was surprised to find my old insertbmp utility. I wasn't even aware that I shared it that early
Meanwhile I gave the source code to misol101 (besides of another function to make the console window transparent). He developed a tremendously improved utility: CmdBkg.
Steffen
-
- Expert
- Posts: 1166
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: Speecher | A Pro Text-to-Speech Engine in Batch | By PaperTronics
PaperTronics wrote:I never thought Batch Legends with the likes of Aacini, aGerman,einstein1969 etc. will see my program.
You didn't think the guys who hang out on this site would see your code?
PaperTronics wrote:Also be sure to check out my website thebateam.org
As a batch enthusiast, it's nice. As a website enthusiast, it's a bit cluttered and the random colorization of various parts of the blog entries seems arbitrary.