当前位置:网站首页>The song of the virtual idol was originally generated in this way!
The song of the virtual idol was originally generated in this way!
2022-07-27 18:41:00 【HMS Core】
HMS Core Audio editing service (Audio Editor Kit)6.6.0 Version Online , New song synthesis ability . Through lyrics and tunes , Combined with different music styles, the machine can also generate highly authentic songs . Support word level input lyrics for phoneme conversion , Generate a song corresponding to the lyrics , Flexible pitch adjustment 、 Gliding 、 Breathing sounds 、 Vibrato and other detailed parameters , Make the song more authentic .

Voice synthesis services can be widely used in Creative production of audio and video 、 Video entertainment 、 music education 、 Virtual idol Other fields . for example , In music creation or short video creative editing , The song synthesis service can help users create and synthesize songs freely , Make the creation more colorful . In the field of virtual idols , Through singing synthesis , It can make virtual people have the ability to sing in a specific timbre , Make it more vivid . In music games or Singing Education , Song synthesis can quickly generate standard reference sound , Improve the efficiency of audio production and save labor costs .
Heard the singing synthesis comparable to the singing effect of real people , Can't wait to use it , The following is the specific integration method of song synthesis . Come and try the integration yourself !
1. The development of preparation
1.1 Register as a developer
Before developing applications, you need to work in Huawei Developer alliance website Register as a developer and complete real name authentication , Please refer to Account registration authentication .
1.2 Create projects and applications
See Create project , Then under the project Create an Complete the creation of the application , Special configurations are as follows :
Selection platform : choice “Web”.
1.3 Open related services
Use Audio Editor Kit Service requires you to AppGallery Connect Open up Audio Editor Kit Service switch , Please refer to Turn on the service switch .
2. Song synthesis function integration
2.1 Synchronization interface ( streaming )
2.1.1 obtain access_token Authentication information
The client obtained by using the developer alliance interface ID And the corresponding key , send out HTTPS POST request , Get query access_token. For the acquisition method, see Client mode (Client Credentials).
2.1.2 according to access_token Call synchronization interface ( streaming )
Obtained through the above steps access_token Information , send out HTTPS POST Call synchronization interface ( streaming ).
Sample code (Java) As shown below :
among requestUrl = "https://audioeditor-api-drcn.cloud.huawei.com/v1/audioeditor/gateway/ai/ttsing/sync".
/** * Call synchronization interface ( streaming ) * @param accessToken according to clientId And key acquisition token * @throws Exception IO abnormal */ private static void syncTask(String accessToken) throws Exception { // Set the request header PostMethod postMethod = new PostMethod(requestUrl); postMethod.setRequestHeader("Content-Type","application/json;charset=utf-8"); postMethod.setRequestHeader("X-Request-ID","9af1aeda-531b-407a-80b4-65b40ef77bd6"); postMethod.setRequestHeader("X-Package-Name","com.huawei.demo"); postMethod.setRequestHeader("X-Country-Code","cn"); postMethod.setRequestHeader("HMS-APPLICATION-ID","123456"); postMethod.setRequestHeader("certFingerprint","xxxxx"); postMethod.setRequestHeader("Authorization","Bearer " + accessToken); // Set the request body Map<String, Object> bodyMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> configMap = new HashMap<>(); // filePath yes MusicXML File path ( Include file name 、 suffix ) String lyricFilePath = "filePath"; dataMap.put("lyric", FileUtils.readFileToString(new File(lyricFilePath), "UTF-8")); dataMap.put("language", "chinese"); configMap.put("type", 1); configMap.put("outputEncoderFormat", 0); bodyMap.put("data", dataMap); bodyMap.put("config", configMap); RequestEntity requestEntity = new StringRequestEntity(JSONObject.toJSONString(bodyMap),"application/json" ,"UTF-8"); postMethod.setRequestEntity(requestEntity); HttpClient httpClient = new HttpClient(); int ret = httpClient.executeMethod(postMethod); if (ret == 200) { Header responseHeader = postMethod.getResponseHeader("content-type"); if ("application/octet-stream".equals(responseHeader.getValue())) { InputStream rpsContent = postMethod.getResponseBodyAsStream(); // filePath Is the path to save the file ( Include file name 、 suffix ) String filePath = "filePath"; FileUtils.copyInputStreamToFile(rpsContent, new File(filePath)); } else { String errorString = postMethod.getResponseBodyAsString(); System.out.println(errorString); } } else { System.out.println("callApi failed: ret =" + ret + " rsp=" + postMethod.getResponseBodyAsString()); } }2.2 Asynchronous interface
2.2.1 Create asynchronous tasks
adopt access_token Information , send out HTTPS POST Create song synthesis asynchronous task .
/** * Call to create an asynchronous task interface * @param accessToken according to clientId And key acquisition token * @throws Exception IO abnormal */ private static void creatAsyncTask(String accessToken) throws Exception { // Set the request header PostMethod postMethod = new PostMethod(requestUrl); postMethod.setRequestHeader("Content-Type","application/json;charset=utf-8"); postMethod.setRequestHeader("X-Request-ID","9af1aeda-531b-407a-80b4-65b40ef77bd6"); postMethod.setRequestHeader("X-Package-Name","com.huawei.demo"); postMethod.setRequestHeader("X-Country-Code","cn"); postMethod.setRequestHeader("HMS-APPLICATION-ID","123456"); postMethod.setRequestHeader("certFingerprint","xxxxx"); postMethod.setRequestHeader("Authorization","Bearer " + accessToken); // Set the request body Map<String, Object> bodyMap = new HashMap<>(); Map<String, Object> dataMap = new HashMap<>(); Map<String, Object> configMap = new HashMap<>(); // filePath yes MusicXML File path ( Include file name 、 suffix ) String lyricFilePath = "filePath"; dataMap.put("lyric", FileUtils.readFileToString(new File(lyricFilePath), "UTF-8")); dataMap.put("language", "chinese"); configMap.put("type", 1); configMap.put("outputEncoderFormat", 0); bodyMap.put("data", dataMap); bodyMap.put("config", configMap); RequestEntity requestEntity = new StringRequestEntity(JSONObject.toJSONString(bodyMap),"application/json" ,"UTF-8"); postMethod.setRequestEntity(requestEntity); HttpClient httpClient = new HttpClient(); int ret = httpClient.executeMethod(postMethod); String rpsContent = postMethod.getResponseBodyAsString(); if (ret == 200) { System.out.println(rpsContent); } else { System.out.println("callApi failed: ret =" + ret + " rsp=" + rpsContent); } }2.2.2 Query asynchronous task status
adopt access_token Information , send out HTTPS POST Query song synthesis asynchronous task status .
/** * Call the interface for querying asynchronous task status * @param accessToken according to clientId And key acquisition token * @throws Exception IO abnormal */ private static void queryAsyncTaskInfo(String accessToken) throws Exception { // Set the request header PostMethod postMethod = new PostMethod(requestUrl); postMethod.setRequestHeader("Content-Type","application/json;charset=utf-8"); postMethod.setRequestHeader("X-Request-ID","9af1aeda-531b-407a-80b4-65b40ef77bd6"); postMethod.setRequestHeader("X-Package-Name","com.huawei.demo"); postMethod.setRequestHeader("X-Country-Code","cn"); postMethod.setRequestHeader("HMS-APPLICATION-ID","123456"); postMethod.setRequestHeader("certFingerprint","xxxxx"); postMethod.setRequestHeader("Authorization","Bearer " + accessToken); // Set the request body Map<String, Object> bodyMap = new HashMap<>(); // taskId The corresponding value is the task returned when creating the asynchronous task ID(taskId) bodyMap.put("taskId", "taskId"); RequestEntity requestEntity = new StringRequestEntity(JSONObject.toJSONString(bodyMap),"application/json" ,"UTF-8"); postMethod.setRequestEntity(requestEntity); HttpClient httpClient = new HttpClient(); int ret = httpClient.executeMethod(postMethod); String rpsContent = postMethod.getResponseBodyAsString(); if (ret == 200) { System.out.println(rpsContent); } else { System.out.println("callApi failed: ret =" + ret + " rsp=" + rpsContent); } }2.2.3 Cancel asynchronous task
adopt access_token Information , send out HTTPS POST Cancel asynchronous task .
/** * Call to cancel the asynchronous task interface * @param accessToken according to clientId And key acquisition token * @throws Exception IO abnormal */ private static void cancelAsuncTask(String accessToken) throws Exception { // Set the request header PostMethod postMethod = new PostMethod(requestUrl); postMethod.setRequestHeader("Content-Type","application/json;charset=utf-8"); postMethod.setRequestHeader("X-Request-ID","9af1aeda-531b-407a-80b4-65b40ef77bd6"); postMethod.setRequestHeader("X-Package-Name","com.huawei.demo"); postMethod.setRequestHeader("X-Country-Code","cn"); postMethod.setRequestHeader("HMS-APPLICATION-ID","123456"); postMethod.setRequestHeader("certFingerprint","xxxxx"); postMethod.setRequestHeader("Authorization","Bearer " + accessToken); // Set the request body Map<String, Object> bodyMap = new HashMap<>(); // taskId The corresponding value is the task returned when creating the asynchronous task ID(taskId) bodyMap.put("taskId", "taskId"); RequestEntity requestEntity = new StringRequestEntity(JSONObject.toJSONString(bodyMap),"application/json" ,"UTF-8"); postMethod.setRequestEntity(requestEntity); HttpClient httpClient = new HttpClient(); int ret = httpClient.executeMethod(postMethod); String rpsContent = postMethod.getResponseBodyAsString(); if (ret == 200) { System.out.println(rpsContent); } else { System.out.println("callApi failed: ret =" + ret + " rsp=" + rpsContent); } }In addition to the ability to synthesize songs , Audio editing service It also provides basic audio editing 、AI Dubbing accompaniment extraction 、 Spatial rendering 、 Rich audio processing capabilities such as variable sound and noise reduction , Provide excellent performance for developers around the world 、 Simple and easy to use 、 An open interface , Help developers easily and efficiently build application audio editing capabilities .
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 ~
边栏推荐
- I was forced to optimize the API gateway query interface
- [mit 6.s081] LEC 9: interrupts notes
- [MIT 6.S081] Lab 7: Multithreading
- Build a simple knowledge question and answer system
- 1. OpenCV image basic operation
- org.apache.catalina.core.StandardContext. startInternal Context [] startup failed due to previous err
- 2021.7.12 internal and external connection of notes
- Deep learning - VIDEO behavior recognition: paper reading - two stream revolutionary networks for action recognition in videos
- Solution to invalid SQL Server connection to server
- [MIT 6.S081] Lab 5: xv6 lazy page allocation
猜你喜欢
![[mit 6.s081] LEC 3: OS organization and system calls notes](/img/34/073d00245eb39844bbe1740f65fe07.png)
[mit 6.s081] LEC 3: OS organization and system calls notes
![[MIT 6.S081] Lab 4: traps](/img/8b/ca4819f8b1cfc6233745a124790674.png)
[MIT 6.S081] Lab 4: traps
![[MIT 6.S081] Lab 10: mmap](/img/5d/a59a6f723518553b9232bc09991075.png)
[MIT 6.S081] Lab 10: mmap

Wechat applet obtains openid, sessionkey, unionid

2021.8.6 notes jsoup

Complete set of machine learning classification task effect evaluation indicators (including ROC and AUC)

Deep learning: GCN (graph convolution neural network) theory learning summary

你有没有在MySQL的order by上栽过跟头

2021.7.12 internal and external connection of notes

Deep learning: gat
随机推荐
XML学习 Day1 : xml / Jsoup解析器 / selector选择器 /Xpath选择器
Uniapp has no effect on the page selector on the app side
2021.7.17 notes MySQL other commands
Wechat applet wxacode.getunlimited generates applet code
Deep learning: Gan optimization method dcgan case
Random talk on GIS data (V) - geographic coordinate system
[mit 6.s081] LEC 1: introduction and examples notes
1. OpenCV image basic operation
Technology sharing | quick intercom integrated dispatching system
Installation and deployment of zabbix6.0
[MIT 6.S081] Lab 7: Multithreading
Common commands of database 1
2021.7.18笔记 mysql数据类型
2021.8.1 notes DBA
Super practical! After reading the kubernetes study notes hidden by Alibaba P9, call NB directly
常用词词性表
MySQL学习 Day3 多表查询 / 事务 / DCL
Deep learning - VIDEO behavior recognition: paper reading - two stream revolutionary networks for action recognition in videos
2021.7.22 note constraints
JDBC学习 Day1:JDBC