xf 听写用pcm
This commit is contained in:
@@ -57,7 +57,7 @@ public class WebIATWS extends WebSocketListener {
|
|||||||
InputStream is;
|
InputStream is;
|
||||||
private String appId;
|
private String appId;
|
||||||
// mp3格式
|
// mp3格式
|
||||||
private String encoding = "lame";
|
private String encoding = "raw";
|
||||||
private AlitaResult<String> result;
|
private AlitaResult<String> result;
|
||||||
|
|
||||||
WebIATWS(InputStream is, String appId) {
|
WebIATWS(InputStream is, String appId) {
|
||||||
|
|||||||
@@ -163,7 +163,7 @@ public class WebTtsWS extends WebSocketListener {
|
|||||||
return AlitaResult.success();
|
return AlitaResult.success();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("err ", e);
|
log.info("err ", e);
|
||||||
return AlitaResult.error("语音听写失败:{}", e.getMessage());
|
return AlitaResult.error("语音合成失败:{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,8 +106,7 @@ public class XfUtils {
|
|||||||
* @author sr on 2025-01-09
|
* @author sr on 2025-01-09
|
||||||
*/
|
*/
|
||||||
public static String iat(String fileCode) {
|
public static String iat(String fileCode) {
|
||||||
FileRecord fileRecord = fileRecordService.find(FileRecord.builder().fileCode(fileCode).build());
|
try (InputStream is = fileRecordService.getFile(fileCode)){
|
||||||
try (InputStream is = FileUtils.convertWebmToMp3(new File(fileRecord.getFilePath()))){
|
|
||||||
AlitaResult<String> result = WebIATWS.execute(is, xfProperties);
|
AlitaResult<String> result = WebIATWS.execute(is, xfProperties);
|
||||||
Assert.isTrue(result.getSuccess(), result.getMsg());
|
Assert.isTrue(result.getSuccess(), result.getMsg());
|
||||||
return result.getData();
|
return result.getData();
|
||||||
|
|||||||
BIN
src/main/resources/iat/cn.pcm
Normal file
BIN
src/main/resources/iat/cn.pcm
Normal file
Binary file not shown.
Reference in New Issue
Block a user