Troubleshooting "System property mbrola.base is undefined. Will not use MBROLA voices" when converting text to speech with JSAPI

user481404 picture user481404 · Oct 20, 2010 · Viewed 11.8k times · Source

I'm getting the following error:

System property "mbrola.base" is undefined.  Will not use MBROLA voices.
import javax.speech.*;
import javax.speech.synthesis.*;
import java.util.Locale;

public class HelloWorld
 {

public static void main(String args[]) 
{

try 
{
// Create a synthesizer for English

Synthesizer synth = Central.createSynthesizer(
new SynthesizerModeDesc(Locale.ENGLISH));

// Get it ready to speak

synth.allocate();

synth.resume();

// Speak the “Hello world” string

synth.speakPlainText("Hello", null);

// Wait till speaking is done

synth.waitEngineState(Synthesizer.QUEUE_EMPTY);

// Clean up

synth.deallocate();

} 
catch (Exception e)
 {
e.printStackTrace();
}

}

}

Answer

coder_2007 picture coder_2007 · Dec 2, 2012

For those who are still struggling with this one, here's how I got it to work on Windows in a plain notepad, no Eclipse involved.

  1. I went to http://tcts.fpms.ac.be/synthesis/mbrola.html and downloaded 2 packages under downloads of binary voices: PC/Windows and PC/DOS

  2. unzip it all and put PC/Windows binary in the same directory as PC/DOS executable mbrola.exe. Please note mbrola.exe didn't work for me b/c it's 16-bit (go figure!), but i found this link:

    http://sourceforge.net/projects/freetts/forums/forum/137669/topic/1219083
    which had a zip file with 2 binaries, one from 2004 that appeared to work on my 64-bit Windows.

  3. Then I downloaded the voices on mbrola website up above in section 1 I wanted a female voice so I grabbed us1 and put the whole folder into the same directory as
    PC/Windows binaries above and PC/DOS executable.

  4. In the code i specified the following: System.setProperty("mbrola.base", "C:\devsrc\main\Head-Rev\src\java\freetts-1.2\mbrola"); voice=vm.getVoice("mbrola_us1");

And I got my female voice. I didn't need any compile or runtime flags.

Hope this helps someone.