2014-03-27 110 views
0

我用java写了文本到语音演示。虽然我为此而努力,但是它并没有和女性的声音说话。使用java的女性语音的文本到语音

我的代码是象下面这样:

try { 
System.setProperty("FreeTTSSynthEngineCentral", 
    "com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); 
System.setProperty("freetts.voices", 
    "com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory"); 
Central.registerEngineCentral("com.sun.speech.freetts.jsapi.FreeTTSEngineCentral"); 

SynthesizerModeDesc desc = new SynthesizerModeDesc(null, "general", 
    Locale.US, null, null); 

Synthesizer synth = Central.createSynthesizer(desc); 
synth.allocate(); 
desc = (SynthesizerModeDesc) synth.getEngineModeDesc(); 
Voice voice = new Voice("kevin16", Voice.AGE_YOUNGER_ADULT, 
    Voice.GENDER_FEMALE, null); 

synth.getSynthesizerProperties().setVoice(voice); 
synth.resume(); 
synth.speakPlainText(text, null); 
synth.waitEngineState(Synthesizer.QUEUE_EMPTY); 
synth.deallocate(); }catch (Exception ex) { 
ex.printStackTrace();} 

将如何改变我的代码了女性的声音。帮我!

+0

我想你是指文本到语音而不是语音到文本? – Henry

+0

是的,我的意思是文本到语音。 –

+0

@HeinMinnSoe请你成功实施女声 – Abderrahim

回答

-2
Voice voice = new Voice("kevin16", Voice.AGE_YOUNGER_ADULT,... 

应该有其他的选择,凯文听起来很适合我。尝试简或东西在那个方向

1

阅读the documentation,我看到:

的FreeTTS的此版本包括:

  • 核心语音合成引擎
  • 了许多声音支持:
    • 一个8khz双音素,,美国英语语音
    • 一个16kHz的音素,男性美国英语语音
    • 一个16kHz的有限域,男性美国英语语音
  • 支持从FestVox导入声音(仅美国英语)
  • 从FestVox导入CMU ARCTIC语音的专门支持(仅限美国英语)
  • 支持MBROLA语音(单独下载):
    • 一个16kHz的,美国英语语音
    • 2 16khz的男性美国英语配音

所以它听起来像它只是附带的男性声音。也许如果你下载MBROLA的一个声音,你会得到一个女性的声音。

另请参阅What voices are available?,它解释了如何获得女性的声音,但注意到“FreeTTS不支持Windows平台上的MBROLA”。