android写pcm文件格式,Android SDK采用流的方式无法识别写过来的pcm数据

Leautolink:

我使用的服务是:语音识别服务

调用的接口是:

asr.send(SpeechConstant.ASR_START, json, null, 0, 0);

参数设置情况:

params.put(SpeechConstant.NLU, "enable");

params.put(SpeechConstant.ACCEPT_AUDIO_VOLUME, false);

params.put(SpeechConstant.VAD, SpeechConstant.VAD_DNN);

params.put(SpeechConstant.SOUND_START, R.raw.start_tone);

params.put(SpeechConstant.PID, 15361);

params.put(SpeechConstant.ACCEPT_AUDIO_DATA, true);

params.put(SpeechConstant.IN_FILE,

"#com.leautolink.multivoiceengins.engine.stt.stream.VoiceInputStream"

+ ".create16kStream()");

开发平台和机型:android

SDK版本号:3.0.3

代码或日志截图(上传截图能帮助您更快解决问题):

7845

7846

复现步骤、现象及其他描述:

通过另一设备将pcm数据,通过流的方式写入VoiceInputStream(是继承InputStream)的,在SpeechConstant.ASR_START的参数里添加inputFile的类型为

"#com.leautolink.multivoiceengins.engine.stt.stream.VoiceInputStream"

+ ".create16kStream()"

,从log看也一直在读:

10-27 17:46:16.575 I/XXX     (21684): --->read: com.leautolink.multivoiceengins.engine.stt.stream.VoiceInputStream@356851a  buffer.length: 1920000  thread  id =2864

但没有识别出传过来的pcm.

最后返回:

10-27 17:46:30.374 I/XXX     (21684): --->read: com.leautolink.multivoiceengins.engine.stt.stream.VoiceInputStream@356851a  buffer.length: 1920000  thread  id =2864

10-27 17:46:30.387 I/BaiduSTTEngine(21684): onEvent---- params : {"origin_result":{"sn":"","error":2,"desc":"Network is not available","sub_error":2100},"error":2,"desc":"Network is not available","sub_error":2100}

10-27 17:46:30.394 I/XXX     (21684): --->read: com.leautolink.multivoiceengins.engine.stt.stream.VoiceInputStream@356851a  size: 0

请问两个问题:

1、InputStream读取有什么要求,之前我们发现读取的byteCount 为3200,现在改为3.0.3版本发现这个值为640了,不知道目前变化了,我们给buffer的时候有什么限制?

2、为何我直接将inputstrem用文件打开赋值为InputStream的方式可以识别,且没看到去调用read的方法,而我采用流的方式向inputstrem里面write数据,就看到有过来调取read,但没有识别?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值