MBROLA与FreeTTS的声音 – Windows
在FreeTTS的Java程序中使用MBROLA语音…
我正在研究Java中的简单文本到语音程序。 我决定使用FreeTTS,但声音并不是我想的那样,而且我还是想用一个女性的声音。 所以我开始环顾四周,并决定使用MBROLA来改变我的文本到语音转换程序的声音 。
我读到“FreeTTS可以使用MBROLA语音” ,但我在各处搜索,找不到如何设置MBROLA的明确指南,以及需要哪些文件。 MBROLA上有许多论坛与FreeTTS一起工作,但似乎没有人知道他们在做什么。
所以问题:
- 需要下载哪些文件?
- 将这些包含在我的程序中的步骤?
- 使用MBROLA语音的简单FreeTTS示例?
感谢在这个论坛上的回复,我终于能够让它发挥作用。 在Windows 10上; 我执行了以下步骤使其工作:
- 下载freeTTS库并将它们包含在eclipse中的Java项目中。
- 下载mbr301d.zip ,将其解压缩到我项目中名为mbrola的文件夹中
- 从http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html下载us1,us2,us3和en1的mbrola数据库
- 直接在mbrola文件夹中提取上一步中下载的语音DB zip – 不要更改文件夹的名称。
- 包含以下代码片段以使用它:
System.setProperty("mbrola.base", "ABSOLUTE_PATH_TO_mbrola_directory_ending_with_/"); voiceManager = VoiceManager.getInstance(); voice = voiceManager.getVoice("mbrola_us1");
注意: 如果您的语音数据库文件夹名称是us1; 那么你应该在上面添加“mbrola_us1”; 如果它是en1,那么它应该是“mbrola_en1” 。 这实际上已经为我做了伎俩。
请从这里找到工作示例:
https://github.com/sunrise-projects/sphinx4/tree/glass
package com.sunriseprojects.freetts.demo; import java.beans.PropertyVetoException; import java.util.Locale; import javax.speech.AudioException; import javax.speech.Central; import javax.speech.EngineException; import javax.speech.EngineStateError; import javax.speech.synthesis.Synthesizer; import javax.speech.synthesis.SynthesizerModeDesc; import javax.speech.synthesis.Voice; public class SpeechUtils { SynthesizerModeDesc desc; Synthesizer synthesizer; Voice voice; public void init(String voiceName) throws EngineException, AudioException, EngineStateError, PropertyVetoException { if (desc == null) { //default // System.setProperty("freetts.voices", // "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); //have to be setup System.setProperty("freetts.voices", "de.dfki.lt.freetts.en.us.MbrolaVoiceDirectory"); desc = new SynthesizerModeDesc(Locale.US); Central.registerEngineCentral("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); synthesizer = Central.createSynthesizer(desc); synthesizer.allocate(); synthesizer.resume(); SynthesizerModeDesc smd = (SynthesizerModeDesc) synthesizer .getEngineModeDesc(); Voice[] voices = smd.getVoices(); Voice voice = null; for (int i = 0; i < voices.length; i++) { if (voices[i].getName().equals(voiceName)) { voice = voices[i]; break; } } synthesizer.getSynthesizerProperties().setVoice(voice); } } public void terminate() throws EngineException, EngineStateError { synthesizer.deallocate(); } public void doSpeak(String speakText) throws EngineException, AudioException, IllegalArgumentException, InterruptedException { synthesizer.speakPlainText(speakText, null); synthesizer.waitEngineState(Synthesizer.QUEUE_EMPTY); } public static void main(String[] args) throws Exception { System.setProperty("mbrola.base", "C:\\lnx1\\home\\ggon\\git-projects\\mbrola"); SpeechUtils su = new SpeechUtils(); //have to be setup on your env su.init("mbrola_us1"); //default //su.init("kevin16"); //su.init("kevin"); //su.doSpeak("Hello world!"); su.doSpeak(SAMPLE); su.terminate(); } final static String SAMPLE = "Wiki said, Floyd Mayweather, Jr. is an American professional boxer. He is currently undefeated as a professional and is a five-division world champion, having won ten world titles and the lineal championship in four different weight classes"; }
- 如何通过单击在Eclipse中启动多个调试会话?
- 从Eclipse启动时创建新的JFrame时,Java正在关闭。 没有exception抛出
- 如何使用其他项目扩展/自定义WAR
- 如何将Project Explorer视图添加到Eclipse RCP应用程序
- 如何让Maven设置(并保持最新)Eclipse项目的构建路径?
- 我如何在eclipse中配置applicationcontext.xml
- Wildfly无法部署应用程序(FileNotFoundException – Access被拒绝)
- Eclipse不会识别使用Maven创建的Java Web项目
- 使用Heroku eclipse插件时,源文件夹不是Java项目