Commit 9f18dc7a authored by 赵啸非's avatar 赵啸非

修改音频识别结果

parent e246480e
......@@ -8,6 +8,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ILogService;
import com.mortals.framework.service.impl.FileLogServiceImpl;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.utils.IatATWSUtil;
import com.mortals.xhx.common.utils.IatModelMulMain;
import com.mortals.xhx.common.utils.IatModelMulUtil;
import lombok.extern.slf4j.Slf4j;
......@@ -43,7 +44,8 @@ public class ApiSendMsgController {
@Autowired
private UploadService uploadService;
private String hostUrl = "https://iat.cn-huabei-1.xf-yun.com/v1"; // 注意多语种识别,也支持中文音频
//private String hostUrl = "https://iat.cn-huabei-1.xf-yun.com/v1"; // 注意多语种识别,也支持中文音频
private String hostUrl = "https://iat-api.xfyun.cn/v2/iat"; // 注意多语种识别,也支持中文音频
private String appid = "3cc52607"; //在控制台-我的应用获取
private String apiSecret = "ZTdmMjFjMGYxYmJhN2VmYjFlMTg3N2Rk"; // 在控制台-我的应用获取
private String apiKey = "d0f73d44e996c2da9924c4476c578a30"; // 在控制台-我的应用获取
......@@ -108,9 +110,10 @@ public class ApiSendMsgController {
byte[] bytes = file.getBytes();
// IatModelMulUtil iatModelMulUtil = new IatModelMulUtil(filePath, appid);
IatModelMulUtil iatModelMulUtil = new IatModelMulUtil(bytes, appid);
// IatModelMulUtil iatModelMulUtil = new IatModelMulUtil(bytes, appid);
IatATWSUtil iatModelMulUtil = new IatATWSUtil(bytes, appid);
String authUrl = IatModelMulUtil.getAuthUrl(hostUrl, apiKey, apiSecret);
String authUrl = IatATWSUtil.getAuthUrl(hostUrl, apiKey, apiSecret);
//log.info("authUrl==>" + authUrl);
OkHttpClient client = new OkHttpClient.Builder().build();
......
......@@ -30,11 +30,6 @@ import java.util.concurrent.CompletableFuture;
@Slf4j
public class IatModelMulUtil extends WebSocketListener {
private final CompletableFuture<String> future = new CompletableFuture<>();
/* private static final String hostUrl = "https://iat.cn-huabei-1.xf-yun.com/v1"; // 注意多语种识别,也支持中文音频
private static final String appid = "3cc52607"; //在控制台-我的应用获取
private static final String apiSecret = "ZTdmMjFjMGYxYmJhN2VmYjFlMTg3N2Rk"; // 在控制台-我的应用获取
private static final String apiKey = "d0f73d44e996c2da9924c4476c578a30"; // 在控制台-我的应用获取
private static final String file = "E://test1.mp3"; // 识别音频位置*/
public static final int StatusFirstFrame = 0;
public static final int StatusContinueFrame = 1;
public static final int StatusLastFrame = 2;
......@@ -74,7 +69,6 @@ public class IatModelMulUtil extends WebSocketListener {
super.onOpen(webSocket, response);
new Thread(() -> {
//连接成功,开始发送数据
//int frameSize = 1280; //每一帧音频的大小,建议每 40ms 发送 122B
int frameSize = 8092; //每一帧音频的大小,建议每 40ms 发送 122B
int intervel = 40;
int status = 0; // 音频的状态
......
......@@ -40,9 +40,9 @@ POST {{baseUrl}}/audio/upload
Content-Type: multipart/form-data; boundary=WebAppBoundary
--WebAppBoundary
Content-Disposition: form-data; name="file"; filename="recording.pcm"
Content-Disposition: form-data; name="file"; filename="test.pcm"
< ./recording.pcm
< ./test.pcm
--WebAppBoundary--
###测试链接数据库
......
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