HMS Core音频编辑服务(Audio Editor Kit)6.6.0版本上线,新增歌声合成能力。通过歌词和曲调,结合不同的曲风让机器也能生成真实度极高的歌声。支持字级别输入歌词进行音素转换,生成对应歌词的歌声,可灵活调整音高、滑音、呼吸音、颤音等细节参数,让歌声更真实。

歌声合成服务可广泛应用于音视频创意制作、影音娱乐、音乐教育、虚拟偶像等领域。例如,在音乐创作或短视频创意编辑时,歌声合成服务可以助力用户自由创作合成歌曲,使创作更加丰富多彩。在虚拟偶像领域,通过歌声合成,可以让虚拟人拥有特定音色歌唱能力,使其形象更生动。在音乐游戏或者歌唱教育中,歌声合成可以迅速生成标准参考声音,提高音频制作效率节省人力成本。
听到了歌声合成媲美真人的歌唱效果,是否迫不及待想上手使用了呢,以下是歌声合成的具体集成方法。快来亲自集成试试吧!
在开发应用前需要在华为开发者联盟网站上注册成为开发者并完成实名认证,具体方法请参见帐号注册认证。
参见创建项目,然后在项目下创建应用完成应用的创建,特殊配置如下:
选择平台:选择“Web”。
使用Audio Editor Kit服务需要您在AppGallery Connect上打开Audio Editor Kit服务开关,具体操作步骤请参见打开服务开关。
2.1.1获取access_token鉴权信息
使用开发者联盟界面获得的客户端ID以及对应密钥,发送HTTPS POST请求,获取查询access_token。获取方式请参见客户端模式(Client Credentials)。
2.1.2根据access_token调用同步接口(流式)
通过以上步骤获取的access_token信息,发送HTTPS POST调用同步接口(流式)。
示例代码(Java)如下所示:
其中requestUrl = "https://audioeditor-api-drcn.cloud.huawei.com/v1/audioeditor/gateway/ai/ttsing/sync"。
/**
* 调用同步接口(流式)
* @param accessToken 根据clientId和密钥获取的token
* @throws Exception IO异常
*/
private static void syncTask(String accessToken) throws Exception {
// 设置请求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);
// 设置请求body
Map<String, Object> bodyMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
Map<String, Object> configMap = new HashMap<>();
// filePath是MusicXML文件路径(含文件名、后缀)
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是要保存文件的路径(含文件名、后缀)
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.1创建异步任务
通过access_token信息,发送HTTPS POST创建歌声合成异步任务。
/**
* 调用创建异步任务接口
* @param accessToken 根据clientId和密钥获取的token
* @throws Exception IO异常
*/
private static void creatAsyncTask(String accessToken) throws Exception {
// 设置请求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);
// 设置请求body
Map<String, Object> bodyMap = new HashMap<>();
Map<String, Object> dataMap = new HashMap<>();
Map<String, Object> configMap = new HashMap<>();
// filePath是MusicXML文件路径(含文件名、后缀)
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查询异步任务状态
通过access_token信息,发送HTTPS POST查询歌声合成异步任务状态。
/**
* 调用查询异步任务状态接口
* @param accessToken 根据clientId和密钥获取的token
* @throws Exception IO异常
*/
private static void queryAsyncTaskInfo(String accessToken) throws Exception {
// 设置请求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);
// 设置请求body
Map<String, Object> bodyMap = new HashMap<>();
// taskId对应的值是创建异步任务时返回的任务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取消异步任务
通过access_token信息,发送HTTPS POST取消异步任务。
/**
* 调用取消异步任务接口
* @param accessToken 根据clientId和密钥获取的token
* @throws Exception IO异常
*/
private static void cancelAsuncTask(String accessToken) throws Exception {
// 设置请求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);
// 设置请求body
Map<String, Object> bodyMap = new HashMap<>();
// taskId对应的值是创建异步任务时返回的任务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);
}
}
除了歌声合成能力,音频编辑服务还提供音频基础编辑、AI配音伴奏提取、空间渲染、变声降噪等丰富的音频处理能力,为全球开发者提供性能优异、简单易用、开放性强的接口,帮助开发者轻松高效构建应用音频编辑能力。
了解更多详情>>
访问华为开发者联盟官网
获取开发指导文档
华为移动服务开源仓库地址:GitHub、Gitee
关注我们,第一时间了解 HMS Core 最新技术资讯~
我有一个Ruby程序,它使用rubyzip压缩XML文件的目录树。gem。我的问题是文件开始变得很重,我想提高压缩级别,因为压缩时间不是问题。我在rubyzipdocumentation中找不到一种为创建的ZIP文件指定压缩级别的方法。有人知道如何更改此设置吗?是否有另一个允许指定压缩级别的Ruby库? 最佳答案 这是我通过查看rubyzip内部创建的代码。level=Zlib::BEST_COMPRESSIONZip::ZipOutputStream.open(zip_file)do|zip|Dir.glob("**/*")d
在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',
我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A
我是Rails的新手,所以请原谅简单的问题。我正在为一家公司创建一个网站。那家公司想在网站上展示它的客户。我想让客户自己管理这个。我正在为“客户”生成一个表格,我想要的三列是:公司名称、公司描述和Logo。对于名称,我使用的是name:string但不确定如何在脚本/生成脚手架终端命令中最好地创建描述列(因为我打算将其设置为文本区域)和图片。我怀疑描述(我想成为一个文本区域)应该仍然是描述:字符串,然后以实际形式进行调整。不确定如何处理图片字段。那么……说来话长:我在脚手架命令中输入什么来生成描述和图片列? 最佳答案 对于“文本”数
我正在使用RubyonRails3.0.9,我想生成一个传递一些自定义参数的link_toURL。也就是说,有一个articles_path(www.my_web_site_name.com/articles)我想生成如下内容:link_to'Samplelinktitle',...#HereIshouldimplementthecode#=>'http://www.my_web_site_name.com/articles?param1=value1¶m2=value2&...我如何编写link_to语句“alàRubyonRailsWay”以实现该目的?如果我想通过传递一些
有这些railscast。http://railscasts.com/episodes/218-making-generators-in-rails-3有了这个,你就会知道如何创建样式表和脚手架生成器。http://railscasts.com/episodes/216-generators-in-rails-3通过这个,您可以了解如何添加一些文件来修改脚手架View。我想把两者结合起来。我想创建一个生成器,它也可以创建脚手架View。有点像RyanBates漂亮的生成器或web_app_themegem(https://github.com/pilu/web-app-theme)。我
导读语言模型给我们的生产生活带来了极大便利,但同时不少人也利用他们从事作弊工作。如何规避这些难辨真伪的文字所产生的负面影响也成为一大难题。在3月9日智源Live第33期活动「DetectGPT:判断文本是否为机器生成的工具」中,主讲人Eric为我们讲解了DetectGPT工作背后的思路——一种基于概率曲率检测的用于检测模型生成文本的工具,它可以帮助我们更好地分辨文章的来源和可信度,对保护信息真实、防止欺诈等方面具有重要意义。本次报告主要围绕其功能,实现和效果等展开。(文末点击“阅读原文”,查看活动回放。)Ericmitchell斯坦福大学计算机系四年级博士生,由ChelseaFinn和Chri
在VMware16.2.4安装Ubuntu一、安装VMware1.打开VMwareWorkstationPro官网,点击即可进入。2.进入后向下滑动找到Workstation16ProforWindows,点击立即下载。3.下载完成,文件大小615MB,如下图:4.鼠标右击,以管理员身份运行。5.点击下一步6.勾选条款,点击下一步7.先勾选,再点击下一步8.去掉勾选,点击下一步9.点击下一步10.点击安装11.点击许可证12.在百度上搜索VM16许可证,复制填入,然后点击输入即可,亲测有效。13.点击完成14.重启系统,点击是15.双击VMwareWorkstationPro图标,进入虚拟机主
需求:要创建虚拟机,就需要给他提供一个虚拟的磁盘,我们就在/opt目录下创建一个10G大小的raw格式的虚拟磁盘CentOS-7-x86_64.raw命令格式:qemu-imgcreate-f磁盘格式磁盘名称磁盘大小qemu-imgcreate-f磁盘格式-o?1.创建磁盘qemu-imgcreate-fraw/opt/CentOS-7-x86_64.raw10G执行效果#ls/opt/CentOS-7-x86_64.raw2.安装虚拟机使用virt-install命令,基于我们提供的系统镜像和虚拟磁盘来创建一个虚拟机,另外在创建虚拟机之前,提前打开vnc客户端,在创建虚拟机的时候,通过vnc
在我让另一个人重做我的前端UI之前,我的Rails应用程序运行平稳。我已经尝试解决此错误3天了。这是错误:Nosuchfileordirectory-identifyExtractedsource(aroundline#59):575859606162@post=Post.find(params[:id])authorize@postif@post.update_attributes(post_params)flash[:notice]="Postwasupdated."redirect_to[@topic,@post]else{"utf8"=>"✓","_method"=>"patc