The Source for Java Technology Collaboration
User: Password:
Register | Login help    

Search

Online Books:
java.net on MarkMail:


Ideas around Java Speech API and Language Translation

Posted by brunogh on November 10, 2008 at 6:26 PM PST

Have you seen this unofficial Java API for Google Translator? So, I was thinking that it could be interesting to mix this stuff with Java Speech API (JSAPI).

JSAPI was divided to support two things: speech recognizers and synthesizers. Speech synthesis is the process of generating human speech from written text for a specific language. Speech recognition is the process of converting human speech to words/commands. This converted text can be used or interpreted in different ways (interesting and simple definition from this article).

It seems that there are not too many open source projects that cares about the recognizer part. I have found a very interesting one called Sphinx, but did not have time to try it yet. I was thinking how cool would be to have an open source software to make possible a talk between two different people, like you say something in a language, it translates to another language and say that. Have anybody seen anything like that? Non commercial? For voip?

So, I work in part of a demo, but only with the the synthesizer part, the text input is manually. I used FreeTTS for that. Basically this piece of code gets an word input in Portuguese, translates it to English and then say the word.

package speech;

import com.google.api.translate.Language;
import com.google.api.translate.Translate;
import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

    public static void main(String[] args) {
        VoiceManager voiceManager = VoiceManager.getInstance();
        Voice voice = voiceManager.getVoice("kevin16");
        voice.allocate();

        String text = null;
        do {
            try {
                System.out.println("Type a word in Portuguese and listen it in English -> ");
                text = new BufferedReader(new InputStreamReader(System.in)).readLine();
                voice.speak(Translate.translate(text, Language.PORTUGESE, Language.ENGLISH));
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } while (!text.equals("!quit"));

        voice.deallocate();
        System.exit(0);
    }
}

If you got excited to work in an open source project like that, go ahead and write something! I can guarantee your fun!

Have a nice week!
Bruno Ghisi
Related Topics >> Mobile and Embedded      
Comments
Comments are listed in date ascending order (oldest first)

Really cool idea ! Don't know any app doing that, but would be interested to contribute in a such project ! Lot of possibility, but I wonder how this can be efficient, cause automatic translation fail on grammar syntax ...

Hello alois, I wish I had time right now to start a project like that. Anyway, if anyone got interested, I can help in some way too. We definitely would find problems with the grammar syntax, but we still can start something... Cheers!

Hai i tried this freetts example, but audio file is not detecting. Tell me how can i overcome this problem....

Hello, please make sure if you have setted it right. Otherwise try its users list.