希望你一切顺利。我们在Ubuntu上使用Voximal(最新版本)和asterisk 13 (16.04.2LTS)。
我正在尝试调用我的java web服务,它返回PCM 8000流,这个流是我们使用Amazon polly生成的,然后我想严格使用vxml通过电话向用户播放相同的流。
首先,我想知道是否可以使用VXML2.1或CCXML播放PCM流,我搜索了很多次,直到现在都没有成功。
这是我的vxml代码,只是疯狂的尝试:)
<?xml version="1.0" encoding="UTF-8"?>
<vxml version="2.1">
<var name="serviceVS" expr="'http://localhost:57144/polly/v1'"/>
<form>
<filled>
<data name="url" srcexpr="serviceVS" method="post" namelist="file"
enctype="multipart/form-data"/>
<assign name="urlToPlay" expr="url.url"/>
<log>
urlToPlay =>
<value expr="urlToPlay"/>
</log>
<audio expr ="urlToPlay"/>
</filled>
</form>
</vxml>下面是我的java代码
@RequestMapping(value="/polly/v1", method = {RequestMethod.POST,RequestMethod.GET})
public ResponseEntity<InputStreamResource> pollyEndPoint(@RequestParam("voiceId") String voiceId,
@RequestParam("text")String text,@RequestParam("outputFormat") String outputFormat){
InputStream speechStream= null;
InputStreamResource inputStreamResource=null;
HttpHeaders headers=null;
try{
speechStream=quikWitService.getPollyTextToSpeech(voiceId,text,outputFormat);
inputStreamResource= new InputStreamResource(speechStream);
headers = new HttpHeaders();
headers.add("Content-Type",QuikWitUtils.getAudioFormatContentType(outputFormat));
}
catch(Exception e){
logger.error(e);
logger.debug(e.getStackTrace());
}
return new ResponseEntity<>(inputStreamResource,headers, HttpStatus.OK);}
如果任何人能给我任何文章或更多的信息,我将不胜感激。
谢谢
发布于 2017-09-21 21:16:31
Polly与Voximal集成在一起(您只需要在TTS/prompt部分设置正确的配置)。Voximal使用命令行"aws“来生成本地音频内容,您可以访问亚马逊TextToSpeech的全部功能,但响应时间应该使用另一种方法来减少(~1s的延迟,但Voximal使用的缓存可以掩盖这种影响)。我们将在下一个Voximal版本中改进Polly集成。
另一种方法是使用我们的TTS/HTTP API创建您自己的Polly集成:https://wiki.voximal.com/doku.php?id=installation_guide:tts_http:start
对于每个部分,如果文本内容不在缓存中,Voximal将生成HTTP请求。
https://stackoverflow.com/questions/46340506
复制相似问题