• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Text to speech

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for my college project i am making a text to speech n speech to test software just needed help that how to make my synthesizer read a documents in my hard disk


NEED HELP!!! ASAP
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The first thing you should do is read KeepItDown and EaseUp.
Then you can try the Java I/O tutorial
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you @Joanne Neal i will definitely KeepItDown and EaseUp thank you for your time appreciated
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to make it read all the notepad files and word document and any other text file on my disk so how can i make synthesizer make read all the files can you please help me with bit of code
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The File class has methods for listing all the files in a directory. The tutorial I linked to above will show you how to read plain text files. Word documents are a little more difficult as they are not plain text. I've never used it but the POI library is often mentioned on these forums when people ask how to read various Microsoft format files such as Word and Excel. The search function on here or Google should be able to provide you with more information about it.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can you help me with a small example
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The tutorial contains plenty of examples. Which bit are you having a problem with ? Show us what you've tried and how the results differ from what you were expecting.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SIR,
I appreciate your time and reply , actually I'am not all that good in coding I'am new to it i don't know how to use FileInputStream along with the synthesizer part of speech .It would be a great help if you can explain with small snippet of code that how can i use synthesizer with FileInputStream
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
it worked thank you so much but still don't know how to read word documents and notepad files
 
Bartender
Posts: 15741
368
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you know how to work with classes, instances and methods? If not, go to the Java tutorials.

If you do, then you need a Reader instance to read words. First you need an instance of FileInputStream. Then create an instance of InputStreamReader using that, and finally create an instance of BufferedReader, and pass the InputStreamReader to it.

Now, using this BufferedReader you can easily read lines from the file.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes sir i did that and its working but dont know how to read microsoft format file and mail box
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaspreet manchinda wrote:yes sir i did that and its working but dont know how to read microsoft format file and mail box


Joanne Neal wrote:Word documents are a little more difficult as they are not plain text. I've never used it but the POI library is often mentioned on these forums when people ask how to read various Microsoft format files such as Word and Excel. The search function on here or Google should be able to provide you with more information about it.

 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The Apache POI library can extract text from various MS Office file formats and Outlook MSG files.

Notepad files are plain text; what particular problem are you facing in reading those?
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i.am abel to read notepad files but exactly dont know how to read word files and emails
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you looked at POI ? What specific problems are you having with it ?
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Text extraction with POI: http://poi.apache.org/hwpf/quick-guide.html
 
Sheriff
Posts: 28399
100
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaspreet manchinda wrote:i.am abel to read notepad files but exactly dont know how to read word files and emails



Here's what I would suggest: You have a limited amount of time to complete this project. It may be that you don't have enough time to deal with plain text and Word documents and e-mails and whatever else you have in mind, so you might find that you end up with an incomplete project which can't handle any of those things properly. So start with plain text ("Notepad") documents and produce something which can read one of those and convert it to spoken form.

At that point you have a project which you could hand in as a finished project, in the worst case. Maybe not very impressive and not what you hoped for, but still a working piece of code. And then if you have more time, you could work on those other formats. Notice that by choosing plain text first, your task then becomes how to convert a Word document (or an e-mail or whatever) to plain text, since you already know how to handle plain text.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
need one more help wen i am trying to change the locale from english to any other language its hiving a java.lang.NullPointerException
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaspreet manchinda wrote:need one more help wen i am trying to change the locale from english to any other language its hiving a java.lang.NullPointerException


The stack trace of the exception will tell you what line of your code it happens on. Use a debugger or put in some print statements to find out which variable is null on that line.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Im not getting that can you please help me with the above code to change the locale i tried japan but its not working
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Post the full stack trace of the exception you get. That will include a line number - tell us which line in your posted code that refers to.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
java.lang.NullPointerException
at HelloWorld.main(HelloWorld.java:20)

 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So "synth" is null - you should read the javadocs of all the methods being used in "Central.createSynthesizer(new SynthesizerModeDesc(Locale.JAPAN))" under which circumstances that can happen.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay. So it's probable that synth on line 20 is null. To confirm this put

before that line and run your program again.
Assuming it is null, you then need to look at the documentation for the Central.createSynthesizer method to see what can cause it to return null.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
its returning true
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaspreet manchinda wrote:its returning true


Okay. So my supposition was correct. So now you

need to look at the documentation for the Central.createSynthesizer method to see what can cause it to return null.

 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not getting it but i guess Central.createSynthesizer returns null if it cannot find a suitable synthesizer
but what should i do
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you installed any synthesizer? If memory serves -and it might not- then the JavaSpeech API does not come with any synthesizers, maybe English but certainly not Japanese; you'd need to get them elsewhere, like from the FreeTTS project.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i tried doing that i downloaded Japanese but it still aint working and i am doin ths using cloudgarden jsapi implementation
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ranchers please help
 
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaspreet manchinda wrote:i tried doing that i downloaded Japanese but it still aint working and i am doin ths using cloudgarden jsapi implementation



What is the Error Message or Exception you are getting this time?
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vishal i am getting the same error that i mentioned earlier
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Deja VU


https://coderanch.com/t/488272/java/java/Null-pointer-exception-code



Just try this out let me know whether this works or not?
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
vishal this is not the case with me
when we pass null value to synthesizer it uses default locale that is english
Central.createSynthesizer(new SynthesizerModeDesc(Locale.ENGLISH))
is same as Central.createSynthesizer(new SynthesizerModeDesc(null))
but my issue is when i trie to change it to Central.createSynthesizer(new SynthesizerModeDesc(Locale.JAPAN)) or any other language it gives java.lang.NullPointerException
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How did you install the Japanese synthesizer? Which instructions did you follow to do that?
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i googled it n downloaded it from some site i forgot to bookmark it from there i downloaded the Japanese locale


can anyone tell me how to save text file in different language i used Unicode instead of ANSI is there any other way to save it
 
Tim Moores
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

jaspreet manchinda wrote:i googled it n downloaded it from some site


OK. What I meant by the question is: are you certain that you did it correctly? It sounds as if it may not be installed.
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes Tim pretty much i am certain bout it
 
Vishal Hegde
Ranch Hand
Posts: 1087
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried this mode


Just try out this Click Here
 
jaspreet manchinda
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First thing vishal here we are talkin about text to speech and RecognizerModeDesc is used in speech to text method and it takes boolean to cheack weather the dictation is supported or not. Synthesizer does not take any boolean
 
reply
    Bookmark Topic Watch Topic
  • New Topic