简体   繁体   English

语音翻译-Android

[英]Voice translation — Android

I am just doing research work, is it possible to convert the voice to voice translation. 我只是在做研究工作,是否可以将语音转换为语音翻译。 Which means that, i am talking in one language the other end person should want to translate my voice in their understandable language. 这意味着,我正在用一种语言进行交谈,而另一位最终用户应该想用他们可以理解的语言来翻译我的声音。 Can we do that in any of google api or recommend me if any other api can do this. 我们可以在任何Google API中做到这一点吗?如果有其他API可以做到这一点,我们是否可以推荐我。 Thanks in advance. 提前致谢。

Yes, you can do that, you need google speech API, you will need to enable this API in google programmer console, there is some trick to enable it, because it is hidden, you need to add yourself to chromium developers list, or something like that. 是的,您可以执行此操作,需要使用Google语音API,需要在Google程序员控制台中启用此API,有一些技巧可以启用它,因为它是隐藏的,您需要将自己添加到Chrome开发者列表中,或者进行其他操作像那样。 You need also a Google translate api for translating text: there is a project for google tranlsate API v2: https://code.google.com/p/google-translate-api-v2-java/ and project for google speech-API: https://github.com/gillesdemey/google-speech-v2/ you need to acquire keys for those APIs from google programmer console. 您还需要一个Google翻译API来翻译文本:有一个针对google tranlsate API v2的项目: https : //code.google.com/p/google-translate-api-v2-java/和一个针对Google Speech-API的项目: https : //github.com/gillesdemey/google-speech-v2/,您需要从Google程序员控制台获取这些API的密钥。 You need to convert your recorded files to flac format, bacause it is required by speech API, you could use flacEncoder project: (http://) javaflacencoder.sourceforge.net/ 您需要将录制的文件转换为flac格式,因为语音API要求使用,您可以使用flacEncoder项目:(http://)javaflacencoder.sourceforge.net/

I think this is all you need, to make a translator from voice input in one language to voice output in any other language. 我想这就是您所需要的,以便使从一种语言的语音输入转换为任何其他语言的语音输出的翻译器。

Algorithm: 算法:

record sound from microphone, encode it to flac format, send it to google for recognition via speech API, when you receive the answer, translate it by google translate API to desired language, after translation, convert the translated text to speech, you could use Google speech API for that, or other text-to-speech engine, this is open to you, because i don't have big experience with that; 记录麦克风中的声音,将其编码为flac格式,通过语音API发送给Google以进行识别,当您收到答案后,通过Google翻译API将其翻译为所需的语言,翻译后,将翻译后的文本转换为语音,则可以使用对此的Google语音API或其他文本语音转换引擎对您开放,因为我对此没有丰富的经验;

Yes. 是。

You can use STT (Speach To Text) API to convert the input voice to text. 您可以使用STT (Speach To Text)语音转换STT (Speach To Text) API将输入语音转换为文本。

The text you can send to a translation API (may be Google or Bing), get it translated to the desired language. 您可以将文本发送到翻译API(可以是Google或Bing),然后将其翻译成所需的语言。

This text, you can send to the TTS (Text To Speech) API and it will be read out. 您可以将这些文本发送到TTS (Text To Speech) API,并将其读出。

You can reffer java-Google-translate-text-to-speech instead of Google Translate API v2 Java. 您可以引用Java-Google-translate-text-to-speech代替Google Translate API v2 Java。 because it's free of cost and for background voice recognition . 因为它是免费的,并且可以进行背景语音识别

It's an unofficial api of Google Translate in Java. 它是Java中Google Translate的非官方api。

It also facilitate text to speech. 它还有助于文本到语音的转换。

Usage of API : API的用法:

    String input="je t'aime";
    Translator translate = Translator.getInstance();
    String text = translate.translate(input, Language.FRENCH, Language.ENGLISH);
    System.out.println("Result :" + text);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM