Reputation:
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?
Upvotes: 2
Views: 3575
Reputation: 2507
You can get the list of available voices by calling
marytts.modules.synthesis.Voice.getAvailableVoices()
Here is the source code for more information.
Upvotes: 2