Commit 8d40c510 authored by helinlin's avatar helinlin

修改阿里云音频识别demo

parent f36e247b
...@@ -26,7 +26,7 @@ public class SpeechTranscriber { ...@@ -26,7 +26,7 @@ public class SpeechTranscriber {
private final SpeechTranscriberListener listener; private final SpeechTranscriberListener listener;
public SpeechTranscriber(File speechFile, SpeechTranscriberListener listener) { public SpeechTranscriber(File speechFile, SpeechTranscriberListener listener) {
if (speechFile == null || !speechFile.exists() || !speechFile.isFile()) { if (speechFile != null && speechFile.exists() && speechFile.isFile()) {
this.speechFile = speechFile; this.speechFile = speechFile;
this.listener = listener; this.listener = listener;
} else { } else {
......
...@@ -26,7 +26,7 @@ public class SpeechApplicationTests { ...@@ -26,7 +26,7 @@ public class SpeechApplicationTests {
//本案例使用本地文件模拟发送实时流数据。您在实际使用时,可以实时采集或接收语音流并发送到ASR服务端。 //本案例使用本地文件模拟发送实时流数据。您在实际使用时,可以实时采集或接收语音流并发送到ASR服务端。
String fileLink = "https://gw.alipayobjects.com/os/bmw-prod/0574ee2e-f494-45a5-820f-63aee583045a.wav"; String fileLink = "https://gw.alipayobjects.com/os/bmw-prod/0574ee2e-f494-45a5-820f-63aee583045a.wav";
//将上面fileLink文件下载到本地后,替换filepath为本地地址测试 //将上面fileLink文件下载到本地后,替换filepath为本地地址测试
String filepath = "D:\\ffmpeg-4.4-full_build-shared\\bin\\test1.wav"; String filepath = "D:\\ffmpeg-4.4-full_build-shared\\bin\\out.pcm";
SpeechTranscriber transcriber = new SpeechTranscriber(new File(filepath), new SpeechTranscriberListener() { SpeechTranscriber transcriber = new SpeechTranscriber(new File(filepath), new SpeechTranscriberListener() {
/** /**
* 语音识别过程中返回的结果。仅当setEnableIntermediateResult为true时,才会返回该消息。 * 语音识别过程中返回的结果。仅当setEnableIntermediateResult为true时,才会返回该消息。
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment