我正在尝试在 CentOS 机器上使用 mbrola 二进制文件。我尝试了下面页面上列出的许多二进制文件,但没有一个有效。 http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html
我收到以下错误 -
Processing Utterance: com.sun.speech.freetts.ProcessException: Cannot start mbrola program:
我相信这很可能是 CentOS 不兼容的二进制文件。您能否告诉我是否有可用于 CentOS 的二进制文件?
代码 -
public static void createAudioFile(String text, String fileName) {
AudioPlayer audioPlayer = null;
//System.setProperty("freetts.voices", "com.sun.speech.freetts.en.us.cmu_time_awb.AlanVoiceDirectory");
System.setProperty("mbrola.base", Constants.mbrolaDiskPath);
Voice voice;
VoiceManager vm = VoiceManager.getInstance();
voice = vm.getVoice("mbrola_us1");
voice.allocate();
try{
String directoryPath = audioDir+fileName;
audioPlayer = new SingleFileAudioPlayer(directoryPath,Type.WAVE);
voice.setAudioPlayer(audioPlayer);
voice.speak(text);
voice.deallocate();
audioPlayer.close();
}
catch(Exception e){
e.printStackTrace();
}
}