当前位置:网站首页>HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
HMS core machine learning service realizes simultaneous interpretation, supports Chinese-English translation and multiple voice broadcast
2022-06-25 17:36:00 【Huawei mobile services】
When users have the need for cross language communication or audio content translation , Applications need to be able to automatically detect voice content and then output it to the language users need .
HMS Core Machine learning services Provide simultaneous interpretation Ability , Simultaneous interpretation realizes real-time translation of real-time input long speech into text and speech of different languages , And real-time output of the original voice text 、 The translated text and the voice broadcast of the translated text .
In the live class , Conference applications , Simultaneous interpretation is particularly important . such as , In conference applications , It can output the speech content of the speaker of the ongoing meeting to the target language in real time , It is convenient for people in different languages to understand the meeting content in real time , Improve meeting efficiency . In live broadcast applications , It can output the spoken content of the anchor to the language required by the user in real time , And then broadcast in real time , Improve the viewing experience of users .
HMS Core Machine learning services Simultaneous interpretation capability not only supports continuous 5 Hours of real-time long voice input is converted to text , It also supports the translation between Chinese and English and the broadcasting of various timbres , Meet the needs of different scenarios in different types of applications .
DEMO Example

Development steps
Before development , You need to complete the necessary development preparations , At the same time, please make sure that your project has been configured with HMS Core SDK Of Maven Warehouse address , And completed the service of SDK Integrate .
SDK The sample code is as follows :
dependencies{
// Introducing simultaneous interpretation services SDK
implementation 'com.huawei.hms:ml-computer-si-sdk:3.5.0.312'
}- Please refer to the instructions for using cloud authentication information , Set the authentication information of your application .
- Create a simultaneous interpreting recognizer , And set the configuration .
MLSimultaneousInterpretationConfig config = new
MLSimultaneousInterpretationConfig.Factory()
// Set source language , At present, it supports Chinese and English
.setSourceLanguage(MLSimultaneousInterpretationConstants.LAN_ZH_CN)
// Set the target language , At present, it supports Chinese and English
.setTargetLanguage(MLSimultaneousInterpretationConstants.LAN_EN_US)
// Set the identification type . Support original text + Translation text + Translation pronunciation
.setResultType(MLSimultaneousInterpretationConstants.RESULT_TYPE_TEXT_TRANSLATED_VOICE)
// Set the speaker , Supporting 、 British male and female voices
.setPerson(MLSimultaneousInterpretationConstants.EN_FEMALE_VOICE)
.create();
MLSimultaneousInterpretationRecognizer = MLSimultaneousInterpretationRecognizer.getInstance();- Create voice recognition result listener callback .
// Callback implementation MLSimultaneousInterpretationListener, Implement the methods in the interface .
protected class SIRecognitionListener implements MLSimultaneousInterpretationListener {
@Override
public void onStartListening() {
// The recorder began to receive sound .
}
@Override
public void onVoiceDataReceived(byte[] data) {
// Return to the user's original PCM Audio stream and audio energy , The interface does not run in the main thread , The returned result needs to be processed in the child thread .
}
@Override
public void onRecognizingResults(Bundle partialResults) {
// from SIRecognitionListener Received text for continuous speech recognition .
// RESULTS_RECOGNIZING: Original text ;RESULTS_TRANS_RECOGNIZING:tts Text ;RESULTS_SN: Original serial number ;RESULTS_TRANS_SN:tts Serial number
}
@Override
public void onResults(Bundle results) {
// from SIRecognitionListener Receive complete sentences
// RESULTS_RECOGNIZED: The original result ;RESULTS_TRANS_RECOGNIZED:tts result
}
@Override
public void onError(int error, String errorMessage) {
// Call the interface after identifying the error .
}
@Override
public void onState(int state, Bundle params) {
// Notify the application that the status has changed .
}
}- Bind the simultaneous interpreting identifier .
mlSimultaneousInterpretationRecognizer.setMLSimultaneousInterpretationListener(new SIRecognitionListener());- call startRecognizing Start speech recognition .
// Start identifying .
mlSimultaneousInterpretationRecognizer.startRecognizing(config);- When the identification is complete , End identifying and releasing resources .
if (mlSimultaneousInterpretationRecognizer!= null) {
mlSimultaneousInterpretationRecognizer.destroy();
}Learn more >>
visit Official website of Huawei developer Alliance
obtain Development guidance document
Huawei mobile service open source warehouse address :GitHub、Gitee
Pay attention to our , The first time to understand HMS Core Latest technical information ~
边栏推荐
- 【UVM实战 ===> Episode_2 】~ VIP、VIP的开发、VIP的发布
- conda安装的py3.6和py3.7
- 智能体白皮书 - 共建智能体,共创全场景智慧 | 云享书库NO.21推荐
- Redis distributed lock collation
- 【Matlab】数据统计分析
- Solution to the problem of incorrect clock in FreeRTOS kernel
- 启牛涨乐财付通下载是可以开户吗?开户安全吗
- [UVM practice== > episode_2] ~ VIP, VIP development, VIP release
- 上线移动ERP系统有哪些步骤?环环紧扣很重要
- Can I open an account? Is it safe to open an account
猜你喜欢

宝藏又小众的国画3d材质贴图素材网站分享

数学建模——非线性规划
![[matlab] curve fitting](/img/58/3fdcc4d34e7c7c71b73324517ff69d.png)
[matlab] curve fitting

Solution to the problem of incorrect clock in FreeRTOS kernel
![Jerry's addition of encrypted file playback function [chapter]](/img/d0/b7a0c9030c157f282405129be51efe.png)
Jerry's addition of encrypted file playback function [chapter]

杰理之唤醒口使用注意事项【篇】

为什么在变频器场合需要安科瑞的电力有源滤波器?
![Jerry's system clock setting is reset or invalid [chapter]](/img/c6/ee6b287af7d309f98abda8e11d674c.png)
Jerry's system clock setting is reset or invalid [chapter]

How does social e-commerce operate and promote?

Why are there few embedded system designers in the soft test?
随机推荐
Sword finger offer II 010 Subarray prefix sum difference with sum K
[matlab] numerical calculus and equation solving
Will the 2022 cloud world be better
杰理之定时器使用注意事项【篇】
杰理之获取复位源和唤醒的 IO 口的方法【篇】
Remote terminal control artifact - mobaxterm
数据搬迁最佳实践之使用CDM搬迁线下MySQL到DWS
mvdr波束 matlab,mvdr波束形成matlab[通俗易懂]
The role of the project manager in the project
Learning Tai Chi makers - mqtt (I) what is mqtt
为什么在变频器场合需要安科瑞的电力有源滤波器?
The second round of Yunnan Cyberspace Security competition in May 2021
[compilation principle] lexical analysis
杰理之增加加密文件播放功能【篇】
conda安装的py3.6和py3.7
Old mobile phones turn waste into treasure and serve as servers
启牛蜻蜓点金下载是可以开户吗?开户安全吗
golang list to string
Mobx学习之路----强大的“状态管理工具”
TCP chat + transfer file server server socket v2.8 - fix 4 known problems