2 回答

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個(gè)贊

TA貢獻(xiàn)2016條經(jīng)驗(yàn) 獲得超9個(gè)贊
我會(huì)建議一個(gè)替代方案。為什么不嘗試使用 windows tts,而是將文本發(fā)送到可以從 java 代碼執(zhí)行的 powershell 命令:
String[] command = {"powershell.exe", "Add-Type -AssemblyName System.Speech; (New-Object System.Speech.Synthesis.SpeechSynthesizer).Speak('" + message +"');"};
try {
ProcessBuilder pb = new ProcessBuilder(command);
Process process = pb.start();
System.out.format("Process exit code: %d", process.waitFor());
ProcessInputOutput.readStdnOutput(process);
}
catch (Exception e){
e.printStackTrace();
}
添加回答
舉報(bào)