The creator of audio and video content has great influence on the editing application AI The demand for dubbing is increasing day by day . It has many advantages , It can not only solve the cost of employing human dubbing, but also the creator's own accent 、 Language and other restrictions , It can also greatly improve production efficiency . such as , The playing time of short video is as short as tens of seconds , Long vlog Types of videos are 4-5 minute , Use AI The dubbing function can realize multiple editing needs in a short time .

HMS Core Audio editing service (Audio Editor Kit) Provide AI Dubbing service , Help developers easily build speech synthesis functions in applications , One key output text can convert voice . It supports cute children's voice , Kind female voice , Sunshine male voice , English male voice 、 Female voice and other styles and timbres , You can also customize the timbre you want . The tone is natural and smooth , Emotional , Meet the needs of audio reading 、 Audio content production 、 Clips and other popular scenes concerned by developers .

Developing actual combat

1. The development of preparation

For detailed preparation steps, please refer to the official website of Huawei developer alliance :

https://developer.huawei.com/consumer/cn/doc/development/Media-Guides/config-agc-0000001154009063?ha_source=hms1

2. Edit project integration

2.1 Set the authentication information of the application

Developers need to go through api_key perhaps Access Token To set the application authentication information .

  • ( recommend ) adopt setAccessToken Method setting Access Token, Initialize settings when the application starts
HAEApplication.getInstance().setAccessToken("your access token");
  • adopt setApiKey Method setting api_key, You can initialize the settings once when the application starts , There is no need to set it more than once .
HAEApplication.getInstance().setApiKey("your ApiKey");

2.2 Initialization environment

Initialize the audio editing management class 、 Create a timeline and the required lanes .

//  Create audio editing management class 
HuaweiAudioEditor mEditor = HuaweiAudioEditor.create(mContext);
// initialization Editor Operating environment
mEditor.initEnvironment();
// Create a timeline
HAETimeLine mTimeLine = mEditor.getTimeLine();
// Create Lane
HAEAudioLane audioLane = mTimeLine.appendAudioLane();

Import music .

//  Add audio resources at the end of the lane 
HAEAudioAsset audioAsset = audioLane.appendAudioAsset("/sdcard/download/test.mp3", mTimeLine.getCurrentTime());

3. AI Dubbing function integration

call HAEAiDubbingEngine Realization AI Dubbing function .

//  Use this configuration class to configure AI Configure the dubbing engine 
HAEAiDubbingConfig haeAiDubbingConfig = new HAEAiDubbingConfig()
// set volume
.setVolume(volumeVal)
// Set the speed of sound
.setSpeed(speedVal)
// Set the speaker
.setType(defaultSpeakerType);
// Single AI Dubbing task callback
HAEAiDubbingCallback callback = new HAEAiDubbingCallback() {
@Override
public void onError(String taskId, HAEAiDubbingError err) {
// error Handle
}
@Override
public void onWarn(String taskId, HAEAiDubbingWarn warn) {}
@Override
public void onRangeStart(String taskId, int start, int end) {}
@Override
public void onAudioAvailable(String taskId, HAEAiDubbingAudioInfo haeAiDubbingAudioFragment, int i, Pair<Integer, Integer> pair, Bundle bundle) {
// Start receiving files , Save as file
}
@Override
public void onEvent(String taskId, int eventID, Bundle bundle) {
// The synthesis is complete.
if (eventID == HAEAiDubbingConstants.EVENT_SYNTHESIS_COMPLETE) {
// AI End of dubbing task processing , That is, all the synthesized audio data are processed
}
}
@Override
public void onSpeakerUpdate(List<HAEAiDubbingSpeaker> speakerList, List<String> lanList,
List<String> lanDescList) { }
};
// AI Dubbing engine
HAEAiDubbingEngine mHAEAiDubbingEngine = new HAEAiDubbingEngine(haeAiDubbingConfig);
// Set up AI Listen during the playback of dubbing task
mHAEAiDubbingEngine.setAiDubbingCallback(callback);
// real time AI Dubbing and playing API,text Pass in the text of the voice to be transferred ,modeAI Dubbing task playback mode
String taskId = mHAEAiDubbingEngine.speak(text, mode);
// Pause play
mHAEAiDubbingEngine.pause();
// Resume playback
mHAEAiDubbingEngine.resume();
// Turn off synthesis
mHAEAiDubbingEngine.stop();

Demo demonstration

< nice to meet you >

More details of Huawei audio editing service , Please refer to :

Service website :https://developer.huawei.com/consumer/cn/hms/huawei-audio-editor/?ha_source=hms1

Get guidance documents :https://developer.huawei.com/consumer/cn/doc/development/Media-Guides/client-dev-0000001107465102?ha_source=hms1

Learn more >>

visit Official website of Huawei developer Alliance

obtain Development guidance document

Huawei mobile service open source warehouse address :GitHubGitee

Pay attention to our , The first time to understand HMS Core Latest technical information ~

The gospel of audio and video developers , Rapid integration AI More articles about dubbing ability

  1. Connect with Netease cloud audio and video 2.0 Call components are integrated into vue in , Realization web End call app, Video voice call .

    The project needs to realize the video call function , After the competition of the company , Adopt Netease Yunxin's video call service ,app The integration of small partners is very smooth .web The end needs to realize the call app End user . Netease Yunxin documents are incomplete ,vue Of demo Can't meet the demand , Communicate with customer service personnel , only ...

  2. Sohu News APP How to use HUAWEI DevEco IDE Rapid integration HUAWEI HiAI Engine

    6 month 12 Japan , Sohu News APP The latest version has been officially launched in the Huawei application market ! that , This version of Sohu News APP What are the highlights ? First throw a picture , Come and feel it directly —— ​ Blur the picture , Instant clarity ! The effect is strong . And hidden behind this divine operation ...

  3. moviepy Audio and video development column Directory

    * ░ Go to the old ape Python Blog Directory ░ <moviepy Audio and video development column > For the charging column , Based on old ape reading moviepy1.03 Version of the source code as well as a large number of test verification based on , Detailed introduction moviepy Main audio and video ...

  4. Rapid integration iOS be based on RTMP Video streaming of

    Preface This article blog yes iOS Video live :< Meow broadcast APP> A supplement to . Because it came to github There is no integrated video streaming in the project on . Many friends asked me how to realize this part of streaming on Jianxin and microblog . therefore , I'll re set ...

  5. [ translate ] C# 8.0 New characteristics Redis Basic use and the use of billions of data in the sharing of skills ( Attached is the video address and viewing guide ) 【 From shallow to deep 】redis There are several ways to implement publish subscribe .NET Core The gospel of developers Redis Another stupid artifact recommended by

    [ translate ] C# 8.0 New characteristics 2018-11-13 17:04 by Rwing, 1179  read , 24  Comment on ,  Collection ,  edit original text : Building C# 8.0[ Translation notes : This is the main title of the original text , But the content ...

  6. Audio and video codec problems :javaCV How to do audio preprocessing and demultiplexing codec quickly ( be based on javaCV-FFMPEG)

    Preface : I used a lot of chapters to achieve javaCV Basic operation , Include : Audio and video capture ( Camera video capture and microphone audio capture ), Push flow ( Local audio and video or camera microphone mixed streaming to the server ), Circumfluence (rtsp->rtmp), Close up ( Recording ...

  7. Rongyun appears with a new version of real-time audio and video LiveVideoStack 2019

    4 month 19 Japan ,LiveVideoStack 2019 The audio and video conference opened in Shanghai , Global Multimedia Innovation experts . Audio and Video Technology Engineer . Product owner . High end industry users will participate in the event together , Focus on the audio . video . Images .AI And so on ...

  8. Android IOS WebRTC Summary of audio and video development ( Sixty three )-- 2016 At home IM Cloud service industry analysis

    This paper mainly focuses on domestic IM Cloud service industry analysis , The article was first published on our WeChat official account , See here for details. , Welcome to WeChat official account. blackerteam, More on www.blackerteam.com talk about IM Our first thought is qq And wechat ...

  9. Android WebRTC Summary of audio and video development

    www.cnblogs.com/lingyunhu/p/3621057.html Previously, I introduced WebRTCDemo Basic structure , This section focuses on the introduction WebRTC Audio and video server processing ,, Reprint please explain the source ( Blog Garden RTC. ...

  10. Geese factory | Get through the small program audio and video and webRTC

    Welcome to Tencent cloud + Community , Get more Tencent mass technology practice dry goods ~ author : Chang Qing, technical director of Tencent video cloud terminal , 2008 I graduated in and joined Tencent , Has been engaged in client research and development related work , Successively participated in PC QQ. mobile phone QQ.QQ Object association Products such as ...

Random recommendation

  1. Javascript The function model of

    analysis : about js Custom function , The content of function body can be roughly abstracted as : Variable ( local variable , from var Keyword definition , Global variables ) And the function ( General functions , Anonymous functions , Closure function ). function SelfDefineFunc() { v ...

  2. Linux Under the system ssh Use ( Based on personal experience )

    about linux For operation and maintenance workers , Use ssh Remote servers are familiar ! about ssh Some strict settings are also related to the security maintenance of the server , Here today , For use in my work ssh In terms of our experience , Make some summary notes . (1)ssh ...

  3. [BS-31] The navigation controller's interactivePopGestureRecognizer attribute

    The navigation controller's interactivePopGestureRecognizer attribute How to customize the navigation controller push The left return button of the view controller ? The first thing to know is : If you want to customize push Coming out VC Left return of ...

  4. javascript Realize the mutual transformation between longitude and latitude and address

    In recent projects, we will use the method of converting addresses to longitude and latitude . Come out of , I have never encountered such problems , I learned in advance , Record what you have learned . I found a lot of information on the Internet , Finally, it was determined that , Baidu API, There are implementation related interfaces (API Address ). Use API ...

  5. POJ_1065_Wooden_Sticks_( Dynamic programming ,LIS+ Pigeon cage principle )

    describe http://poj.org/problem?id=1065 The stick has weight w And length l Two properties , To make l and w At the same time, it is monotonous , Otherwise, the cutting machine will stop once , Ask how many stops at least ( Stop once at the beginning ). Wo ...

  6. be based on agenda Of Nodejs Set up a timed task management framework

    0. background In large projects , The application scenarios of scheduled tasks are becoming more and more extensive . Generally speaking , According to the idea of microservice , We will deploy a set of services separately for scheduled tasks , The core business interface is independent of another service , So as to reduce the degree of mutual coupling . When you need to use scheduled tasks , only ...

  7. maven Load local jar Package to repository

    maven Load local jar To repository This is a common scenario , Here, local opencv jar File import repository For example 1.Ubuntu Next mvn install:install-file ...

  8. BZOJ 1854: [Scoi2010] game ( Bipartite map matching / Union checking set )

    Topic : https://www.lydsy.com/JudgeOnline/problem.php?id=1854 Answer key : 1. Bipartite map matching : First of all, we found that each piece of equipment can only choose one of the two attributes . therefore , We take every ...

  9. web Multi site cross domain access

    Sometimes projects app and m We need to share a set of interfaces This time we need to use cross domain : especially app Interface cross domain access site . Cross domain configuration : 1.iis You need to install... On the server URLwrite2.0 2.web.config You need to add this configuration : ...

  10. mui How to use native JavaScript Instead of jquery To operate dom

    Recently in use mui Write page , Of course, on the move App In the introduction jq or zepto These frameworks , It must be very irrational . Native JS It's very simple , Why do I need jq?jq My success was due to ie6.7.8.9.10.chrome.ff These browsers are not compatible ...