|
|
||
Bruno Ghisi's BlogIdeas around Java Speech API and Language TranslationPosted by brunogh on November 10, 2008 at 06:26 PM | Comments (4)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 Bookmark blog post: CommentsComments are listed in date ascending order (oldest first) | Post Comment
| ||
|
|