6

I am currently making a project for school, where I am going to make a program which teaches children how to read. My basic idea for the program was produce the sentence and then get Windows Anna to say it. My question to you is, how can I access Winodws Anna through Java? and is there a better way of doing this?

Thanks

Xyene
  • 2,304
  • 20
  • 36
Jeel Shah
  • 3,274
  • 17
  • 47
  • 68
  • Do you mean this by java api for sound: http://java.sun.com/products/java-media/speech/index.jsp? – jobnz May 13 '12 at 18:20
  • Actually [there is a solution][1] for calling Windows synthetizer already there. [1]: http://stackoverflow.com/questions/1040655/ms-speech-from-command-line – npe May 17 '12 at 09:52
  • I do have a question: is this program allowed to access the internet? – Xyene May 17 '12 at 16:04

4 Answers4

3

If having the program access internet is acceptable, then you could use iSpeech.

You can use their API, but the problem with that is that it is limited to 200 uses/day.

iSpeech has decently sounding voices, generally more polished than other TTS engines I've tired like espeak or FreeTTS, because it actually pronounces the words more fluently. Sure, it might pronounce 'Wind', relating with air, as 'Wind', relating to twisting, but other than that, it speaks quite well.

Also, while I haven't had any prior experience with this, I found an article that shows you how to access the MS Speech with command line (which can obviously be commanded through Java[if you do not know how, here is a good article]). It is located here. In command line, all you do is type in 'SayDynamic.exe* the text you want to speak".

*Or SayStatic, the other download available on the page.

This method seems to be better in terms of speed and not relying on internet access, but it definitely does NOT pronounce things as well as iSpeech. I guess the ideal thing for your program to have would be to use iSpeech when online, and use the Say*.exe when offline.

The site also provides the source code of the program. As you might notice, it is NOT Microsoft Anna's voice, but you can specify that in the source and recompile it.

Hope I helped!

Community
  • 1
  • 1
Xyene
  • 2,304
  • 20
  • 36
  • Yes, this program is able to access the internet. – Jeel Shah May 18 '12 at 12:54
  • Hi, I am unable to open you link where it shows how to use MS speech. – Jeel Shah May 22 '12 at 23:06
  • Ah, yes... The site seems to be down. I'm uploading the executable to DropBox right now. When it finishes, it will be downloable from http://dl.dropbox.com/u/67341745/SayDynamic.exehttp://dl.dropbox.com/u/67341745/SayDynamic.exe. This is the compiled executable only: you will have to wait for the site to come back up to get the source. – Xyene May 23 '12 at 00:38
  • Thanks a bunch, When I am executing this do I do something like `SayDynamic.exe 'whatever'` – Jeel Shah May 23 '12 at 02:44
1

You can use command line utiity NirCmd that uses text-to-speech API installed on Windows.

So, supply this utility together with your java application and run it with appropriate command line.

radimpe
  • 3,197
  • 2
  • 27
  • 46
AlexR
  • 114,158
  • 16
  • 130
  • 208
0

You can try FreeTTS : a speech synthesizer written in java.

You can try to call the Microsoft Speech API (SAPI) but I don't know how to do it in java.

Can you tell us how you invoke NirCmd ? Altenatively to NirCmd, you can build your own tool in C# that will read the text. The text could be within a txt and your tool invoked with the path to that txt as argument. You can easily adapt a demo project like this one : http://www.codeproject.com/Articles/19334/Text-to-Speech-using-Windows-SAPI

Community
  • 1
  • 1
Guillaume
  • 12,824
  • 3
  • 40
  • 48
0

There is the Speech platform of Windows http://www.microsoft.com/en-us/download/details.aspx?id=27226

The Speech runtime http://www.microsoft.com/en-us/download/details.aspx?id=27225

You can use JNA (not JNI) to interact with dll from java https://github.com/twall/jna

miks
  • 514
  • 2
  • 5