2014-03-27 107 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」。