How do I use other voices when using MaryTTS embed?

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-10 13:49:08

问题


I want to use MaryTTS embed in my Java application. I have downloaded the jars and put them in my classpath. I can successfully run this test:

    public static void main(String[] args) throws Exception {
        MaryInterface marytts = new LocalMaryInterface();
        Set<String> voices = marytts.getAvailableVoices();
        marytts.setVoice(voices.iterator().next());
        AudioInputStream audio = marytts.generateAudio("Hello world.");
        AudioPlayer player = new AudioPlayer(audio);
        player.start();
        player.join();
    }

The problem is that the only voice available is cmu-slt-hsmm, which makes sense because that's the only voice- jar I have in the classpath. However, I cannot find anywhere other jars for other voices, which leads me to believe I'm doing something wrong because the Mary GUI can use other voices just fine.

How do I use other voices when using MaryTTS embed?


回答1:


You need to find or create new voice jar and add this voice jar in your libs. MaryTTS does this itself using the component-installer, but i prefere to download jars manualy from official website.

Here is the list of all available voices. So, lets suppose you want to add voice-dfki-spike-hsmm. Find apropriate name in marytts-components.xml and link will usually look something like this: http://mary.dfki.de/download/5.1/voice-dfki-spike-hsmm-5.1.zip. Now you can easily unzip and put this voice to your project libs next to maryTTS source.

Demo

Set<String> voices = maryTTS.getAvailableVoices();
for(String v : voices){
    System.out.println("Voice available: " + v);
}

Result:

Voice available: cmu-slt-hsmm
Voice available: voice-dfki-spike-hsmm

If you use maryTTS GUI you probably already have all voices somewere on your hard drive. This article may help you to find them: http://myrobotlab.org/content/marytts-multi-language-support

PS. TTS voices themselves have individual licenses, so don't forget to look at it in marytts-components.xml. Usually Creative Commons, but depending on the voice's license, it may or may not be used commercially.



来源:https://stackoverflow.com/questions/35932491/how-do-i-use-other-voices-when-using-marytts-embed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!