调整调用算法语音合成,去掉部分引起的杂音符号
This commit is contained in:
parent
a2c2b35d13
commit
5ddc7091d4
@ -137,6 +137,7 @@ public class BaseWebSocketProcess {
|
||||
sb.setLength(0);
|
||||
sb.append(old.substring(m));
|
||||
old = old.substring(0, m);
|
||||
|
||||
normalSendMsg(baseSession, old, type, YesNo.NO.getCode());
|
||||
} else {
|
||||
sb.append(message);
|
||||
@ -677,8 +678,16 @@ public class BaseWebSocketProcess {
|
||||
|
||||
private void sendMsg(BaseSession baseSession, BaseMessageResp baseMessageResp) {
|
||||
if(ttsSuanfa && this instanceof BoxWebSocketHandler){
|
||||
audioService.getAudioUrl(baseMessageResp.getText()).map(s ->{
|
||||
log.info("音频地址:{}", s);
|
||||
String text = baseMessageResp.getText().replace("\n", "").replace("\t", "");
|
||||
if(text.startsWith(",") ||
|
||||
text.startsWith("。") ||
|
||||
text.startsWith(":") ||
|
||||
text.startsWith(";") ||
|
||||
text.startsWith("《")){
|
||||
//标点符号起始会导致合成的声音第一句话有杂音
|
||||
text = text.substring(1);
|
||||
}
|
||||
audioService.getAudioUrl(text).map(s ->{
|
||||
BoxMessageResp boxMessageResp = new BoxMessageResp();
|
||||
BeanUtils.copyProperties(baseMessageResp, boxMessageResp);
|
||||
boxMessageResp.setAudio(s);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user