AutoHotkey Community

It is currently May 27th, 2012, 12:07 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: March 3rd, 2011, 4:21 am 
Offline

Joined: April 22nd, 2008, 7:13 pm
Posts: 82
Hi AHKers
Here's something I found today which does great text2speech

http://translate.google.com/translate_t ... lo%20world

It returns you an mp3 with the text transformed into a clear, friendly voice. just change around the last bit to be whatever text you need spoken.

evs

_________________
Inventing problems that need solutions...

Open Communicator
MouseTrainer


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 5:23 am 
Offline

Joined: December 26th, 2010, 7:40 pm
Posts: 4172
Location: Awesometown, USA
I tink this belongs in the general section - I can't help you with this since there is no problem.

I think the "post helpful tips and tricks" is about common problems, as with the stickys.

_________________
Autofire, AutoClick, Toggle, SpamWindow Control Tools
Recommended: AutoHotkey_L


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 5:24 am 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
OMG thanks for that.. I was using a 3rd party driver to snag the audio from the site before.
Used it here ( at the start ) ;)
How is that linked to the main translate page?? I dont see save as mp3 anywhere..

Much appreciated!

BTW this would make a very cool AHK project!

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 3rd, 2011, 8:47 am 
Offline

Joined: February 20th, 2011, 9:42 pm
Posts: 433
Location: Cache Creek B.C.
I've integrated your idea into something... I think it would count as help for evandevon's potential problem... how to incorporate said speech function?
This is part of my "Aaron's Super Google Search" script.

First you use FileCreateDir to make a folder in %temp% like:
Code:
FileCreateDir, %temp%\foldername ; makes folder in temp folder

Then make an input box:
Code:
Gui, Add, Edit,  (size etc...) vInput ; makes search edit box

Then assign it to a control. In my case it's a button:
Code:
ButtonSpeech:
Gui, Submit, NoHide ; sends input to variable
FileDelete, %temp%\foldername\*.mp3 ; gets rid of existing speech files
UrlDownloadToFile, http://translate.google.com/translate_tts?tl=en&q=%Input%`., %temp%\foldername\%Input%.mp3
Soundplay, %temp%\foldername\%Input%.mp3, Wait ; plays the downloaded speech file and waits for it to finish
FileDelete, %temp%\foldername\*.mp3 ; deletes sound file and is ready for new one
GoTo Next


It works very nicely in my "Aaron's Super Google Search" :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 10:09 am 
Offline

Joined: October 2nd, 2009, 12:43 pm
Posts: 283
Image
Doesn't work for me.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 10:30 am 
Offline

Joined: February 20th, 2011, 9:42 pm
Posts: 433
Location: Cache Creek B.C.
I don't see HTTP:\\ in front of that address you're showing... try that?
It works for me, I've already built it into a script


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 11:03 am 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
flak wrote:
Doesn't work for me.


Strangely, this does not seem to work in Chrome. Works with IE and firefox.

_________________
If i've seen further it is by standing on the shoulders of giants

my site | ~shajul | WYSIWYG BBCode Editor


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 3rd, 2011, 1:43 pm 
Offline

Joined: February 20th, 2011, 9:42 pm
Posts: 433
Location: Cache Creek B.C.
EDIT: Chrome users MUST type "HTTP://" (without quotes) into the address bar manually, unless you launch the URL from a script.

...and you need to fill in the speech end of the URL with "%20" (without the quotes) in place of spaces, or it can return an error.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2011, 11:23 pm 
Offline

Joined: August 21st, 2006, 7:07 pm
Posts: 2925
Location: The Shell
bump

_________________
Imageparadigm.shift:=(•_•)┌П┐RTFM||^.*∞


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2011, 4:34 pm 
Offline

Joined: March 18th, 2011, 12:11 pm
Posts: 38
Location: Sweden
I took aaronbewza's example and came up with this.
since I want to save the files and to chose the language I added one droplist.

mabye useful to some.

Code:
FileCreateDir, c:\GoogleSpeech ; makes folder in temp folder
Gui, Add, DropDownList, vLang, sv|en
Gui, Add, Edit,  (size etc...) vInput ; makes search edit box
gui, add, button, ,Speech
gui, show
ButtonSpeech:
Gui, Submit, NoHide ; sends input to variable
FileDelete, c:\GoogleSpeech\%Input%.mp3 ; gets rid of existing speech file
UrlDownloadToFile, http://translate.google.com/translate_tts?tl=%Lang%&q=%Input%`., c:\GoogleSpeech\%Input%.mp3
Soundplay, c:\GoogleSpeech\%Input%.mp3, Wait ; plays the downloaded speech file and waits for it to finish
return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2011, 9:01 pm 
Offline

Joined: February 20th, 2011, 9:42 pm
Posts: 433
Location: Cache Creek B.C.
cool stuff! :)
I added IfInString/StringReplace for spaces and question marks so errors are minimized (and a couple more language selections), default choice is first entry:
Code:
FileCreateDir, c:\GoogleSpeech ; makes folder in temp folder
Gui, Add, DropDownList, vLang Choose1, sv|en|fr|es|de|fi|el|ja|pl|ru|uk
Gui, Add, Edit,  (size etc...) vInput ; makes search edit box
gui, add, button, Default ,Speech ; ENTER presses this button
gui, show
ButtonSpeech:
Gui, Submit, NoHide ; sends input to variable
 IfInString, Input, %A_Space% ; Looks for spaces in Input variable
  StringReplace, Input, Input, %A_Space%, `%20, All ; Replaces spaces with "%20" (html) to minimize errors from Google Translate
 IfInString, Input, `? ; Looks for question marks in Input variable
  StringReplace, Input, Input, `?, `&`#63, All ; Replaces question marks with "&#63" (html)
FileDelete, c:\GoogleSpeech\%Input%.mp3 ; gets rid of existing speech file
UrlDownloadToFile, http://translate.google.com/translate_tts?tl=%Lang%&q=%Input%`., c:\GoogleSpeech\%Input%.mp3
Soundplay, c:\GoogleSpeech\%Input%.mp3, Wait ; plays the downloaded speech file and waits for it to finish
return
GuiClose:
ExitApp

_________________
Some of my scripts :).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2011, 9:48 pm 
Offline

Joined: March 18th, 2011, 12:11 pm
Posts: 38
Location: Sweden
nice, Minor change since I like to have the Mp3 name without %20 thing.

Code:
FileCreateDir, c:\GoogleSpeech ; makes folder in temp folder
Gui, Add, DropDownList, vLang Choose1, en|sv|fr|es
Gui, Add, Edit,  (size etc...) vInput ; makes search edit box
gui, add, button, Default ,Speech ; ENTER presses this button
gui, show
ButtonSpeech:
Gui, Submit, NoHide ; sends input to variable
IfInString, Input, %A_Space% ; Looks for spaces in Input variable
StringReplace, Output, Input, %A_Space%, `%20, All ; Replaces spaces with "%20" to minimize errors from Google Translate
FileDelete, c:\GoogleSpeech\%Input%.mp3 ; gets rid of existing speech file
UrlDownloadToFile, http://translate.google.com/translate_tts?tl=%Lang%&q=%Output%`., c:\GoogleSpeech\%Input%.mp3
Soundplay, c:\GoogleSpeech\%Input%.mp3, Wait ; plays the downloaded speech file and waits for it to finish
return
GuiClose:
ExitApp


Edit: Geting some strange result when using swedish "åäö", I will look in to that later.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2011, 12:59 am 
Offline

Joined: February 20th, 2011, 9:42 pm
Posts: 433
Location: Cache Creek B.C.
for å it is

`&`#229;
(escape the first two characters)

Check this out:

http://www.ascii.cl/htmlcodes.htm <-- EDIT: WRONG ONES!

The page has HTML code for every character you are looking for, and considering your Input goes into a URL http address line, it would probably be a good idea to substitute the proper HTML code for all special characters.
Someone might want to find or build a "Character to HTML Converter" script?

I made a mistake on the HTML for the Question Mark... it should be
`&`#63;
not
`&`#63

sorry about that! (remember to escape the weird characters if need be)

EDIT: after much experimentation, these codes simply do not work. :(

_________________
Some of my scripts :).


Last edited by aaronbewza on May 18th, 2011, 2:09 am, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2011, 1:07 am 
Offline
User avatar

Joined: May 18th, 2010, 3:10 pm
Posts: 1179
Location: Sweden
aaronbewza wrote:
for å it is

`&`#229;
(escape the first two characters)

Check this out:

http://www.ascii.cl/htmlcodes.htm

The page has HTML code for every character you are looking for, and considering your Input goes into a URL http address line, it would probably be a good idea to substitute the proper HTML code for all special characters.
Someone might want to find or build a "Character to HTML Converter" script?

I made a mistake on the HTML for the Question Mark... it should be
`&`#63;
not
`&`#63

sorry about that! (remember to escape the weird characters if need be)


Yeah I've also been looking for something like that :(

_________________
~sumon Appifyer AHK Nova halted Recommended: AHK_L (Why?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 18th, 2011, 1:09 am 
Offline

Joined: February 20th, 2011, 9:42 pm
Posts: 433
Location: Cache Creek B.C.
I think a subroutine on this script could do the HTML conversion on characters from different languages?
I'm going to start one.

EDIT: it looks like the HTML codes I mentioned do not actually work :(

Below in the code box is the actual table of codes to use in URL addresses (without percent signs) :
Code:
ASCII Character    URL-encoding
space    %20
!    %21
"    %22
#    %23
$    %24
&    %26
'    %27
(    %28
)    %29
*    %2A
+    %2B
,    %2C
-    %2D
.    %2E
/    %2F
0    %30
1    %31
2    %32
3    %33
4    %34
5    %35
6    %36
7    %37
8    %38
9    %39
:    %3A
;    %3B
<    %3C
=    %3D
>    %3E
?    %3F
@    %40
A    %41
B    %42
C    %43
D    %44
E    %45
F    %46
G    %47
H    %48
I    %49
J    %4A
K    %4B
L    %4C
M    %4D
N    %4E
O    %4F
P    %50
Q    %51
R    %52
S    %53
T    %54
U    %55
V    %56
W    %57
X    %58
Y    %59
Z    %5A
[    %5B
\    %5C
]    %5D
^    %5E
_    %5F
`    %60
a    %61
b    %62
c    %63
d    %64
e    %65
f    %66
g    %67
h    %68
i    %69
j    %6A
k    %6B
l    %6C
m    %6D
n    %6E
o    %6F
p    %70
q    %71
r    %72
s    %73
t    %74
u    %75
v    %76
w    %77
x    %78
y    %79
z    %7A
{    %7B
|    %7C
}    %7D
~    %7E
     %7F
€    %80
     %81
‚    %82
ƒ    %83
„    %84
…    %85
†    %86
‡    %87
ˆ    %88
‰    %89
Š    %8A
‹    %8B
Œ    %8C
     %8D
Ž    %8E
     %8F
     %90
‘    %91
’    %92
“    %93
”    %94
•    %95
–    %96
—    %97
˜    %98
™    %99
š    %9A
›    %9B
œ    %9C
     %9D
ž    %9E
Ÿ    %9F
     %A0
¡    %A1
¢    %A2
£    %A3
     %A4
¥    %A5
|    %A6
§    %A7
¨    %A8
©    %A9
ª    %AA
«    %AB
¬    %AC
¯    %AD
®    %AE
¯    %AF
°    %B0
±    %B1
²    %B2
³    %B3
´    %B4
µ    %B5
¶    %B6
·    %B7
¸    %B8
¹    %B9
º    %BA
»    %BB
¼    %BC
½    %BD
¾    %BE
¿    %BF
À    %C0
Á    %C1
    %C2
à    %C3
Ä    %C4
Å    %C5
Æ    %C6
Ç    %C7
È    %C8
É    %C9
Ê    %CA
Ë    %CB
Ì    %CC
Í    %CD
Î    %CE
Ï    %CF
Ð    %D0
Ñ    %D1
Ò    %D2
Ó    %D3
Ô    %D4
Õ    %D5
Ö    %D6
     %D7
Ø    %D8
Ù    %D9
Ú    %DA
Û    %DB
Ü    %DC
Ý    %DD
Þ    %DE
ß    %DF
à    %E0
á    %E1
â    %E2
ã    %E3
ä    %E4
å    %E5
æ    %E6
ç    %E7
è    %E8
é    %E9
ê    %EA
ë    %EB
ì    %EC
í    %ED
î    %EE
ï    %EF
ð    %F0
ñ    %F1
ò    %F2
ó    %F3
ô    %F4
õ    %F5
ö    %F6
÷    %F7
ø    %F8
ù    %F9
ú    %FA
û    %FB
ü    %FC
ý    %FD
þ    %FE
ÿ    %FF

_________________
Some of my scripts :).


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Yahoo [Bot] and 18 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group