Search code examples
javatext-to-speechmarytts

MaryTTS voice name


Recently I've found a way to make Text To Speech in Java (MaryTTS:http://mary.dfki.de/index.html)

I've found this code to use it in Java:

public class MaryTTSRemote
{
    private MaryInterface marytts;
    private AudioPlayer ap;

    public MaryTTSRemote(String voiceName)
    {
        try
        {
            marytts = new LocalMaryInterface();
            marytts.setVoice(voiceName);
            ap = new AudioPlayer();
        }
        catch (MaryConfigurationException ex)
        {
            ex.printStackTrace();
        }
    }

    public void say(String input)
    {
        try
        {
            AudioInputStream audio = marytts.generateAudio(input);

            ap.setAudio(audio);
            ap.start();
        }
        catch (SynthesisException ex)
        {
            System.err.println("Error saying phrase.");
        }
    }
}

But when I try to run this class I don't know what name the basic voice has. Does someone know what string I have to give this class to get it working?


Solution

  • You can get the list of available voices by calling

    marytts.modules.synthesis.Voice.getAvailableVoices()
    

    Here is the source code for more information.