MBROLA with FreeTTS - Windows

Using MBROLA Voices in Java Program with FreeTTS ...

I am working on a simple text to speech program in Java. I decided to use FreeTTS, but the voices are not really what I thought, and I wanted to use a female voice anyway. So I started looking around and decided that I would use MBROLA to change the voice of my text-to-speech program.

I read that "FreeTTS can use MBROLA voices" , but I searched everywhere and could not find a clear guide on how to install MBROLA and what files are needed to do so. There are many MBROLA forums working in conjunction with FreeTTS, however, it also seems that no one else knows what they are doing.

So the questions:

  • What files do I need to download?
  • Steps to include them in my program?
  • Simple example of FreeTTS using MBROLA voices?

source to share

3 answers

Answers to the above questions:

1. What files do I need to download?

1.1 FreeTTS Libraries (found in freetts-1.2.2-bin / freetts-1.2 / lib):

  • cmu_time_awb.jar
  • cmu_us_kal.jar
  • cmudict04.jar
  • cmulex.jar
  • cmutimelex.jar
  • en_us.jar
  • freetts.jar
  • FreeTTS-jsapi10.jar
  • mbrola.jar

1.2 The MBROLA mail folder will include:

  • mbrola.exe
  • mbr302a (folder)
  • readme.txt

1.3 Voices are ZIP folders containing one folder named " us1 " or " af1 ", etc.

2. Steps to include them in my program?

NOTE: I had MBROLA Tooklit installed on my computer, however I am not sure if this is affecting the program, but I suspect it is not. EDIT: I tested if the MBROLA toolkit needs to be used to run MBROLA along with FreeTTS and it turns out that it is not needed.

  • Extract freetts-1.2.2-bin
  • Copy libraries to your project and include in build path
  • Unzip the mbr301d.zip folder
  • Rename 'mbr301d' to 'mbrola'
  • Unzip the voices into a folder named "mbrola"

After that, your mbrola folder should look like this:

  • [mbr302a] - folder
  • [us1] - folder (the name depends on the language you downloaded)
  • mbrola.exe - file
  • readme.txt - file

You can put all your languages ​​in this folder and they will simply be called from your Java program.

3. Simple example of FreeTTS using MBROLA voices?

I've seen a lot of people get this error:

System property "mbrola.base" is undefined.  Will not use MBROLA voices.



denotes where your mbrola files are located on your computer and without setting the property to the correct location, you will get this error.

For NON-MBROLA users who get this error: Just remove mbrola.jar from your referenced libraries only if you are using FreeTTS

To set a property mbrola.base


System.setProperty("mbrola.base", "C:/Path/to/your/mbrola")


Below is a simple example of using MBROLA voices in your FreeTTS program. Please note that the above steps must be done before this will work. Simply changing the voice name to "mbrola_us1" will not work if the base is not installed!

package com.madmob.test;

import com.sun.speech.freetts.Voice;
import com.sun.speech.freetts.VoiceManager;

public class TestTTS {
    VoiceManager freettsVM;
    Voice freettsVoice;

    public TestTTS(String words) {
        // Most important part!
        System.setProperty("mbrola.base", "C:/mbrola");
        freettsVM = VoiceManager.getInstance();

        // Simply change to MBROLA voice
        freettsVoice = freettsVM.getVoice("mbrola_us1");

        // Allocate your chosen voice

    public void sayWords(String words) {
        // Make her speak!

    public static void main(String [] args) {
        new TestTTS("Hello there! Now M BROLA and Free T T S work together!");


Now MBROLA and FreeTTS will work together! This code was copied straight from my computer and tested before I put it here.



Thanks to the answers on this forum, I was finally able to get it to work. On windows 10; I followed these steps to get it working:

  • Download the freeTTS libraries and include them in my Java project in eclipse.
  • Download mbr301d.zip , extract it to a folder named mbrola in my project
  • Download mbrola database for us1, us2, us3 and en1 from http://www.tcts.fpms.ac.be/synthesis/mbrola/mbrcopybin.html
  • extract the DB voicemail downloaded in the previous step directly to the mbrola folder - don't change the folder names.
  • include the following code snippets to use it:
    System.setProperty("mbrola.base", "ABSOLUTE_PATH_TO_mbrola_directory_ending_with_/");
    voiceManager = VoiceManager.getInstance();
    voice = voiceManager.getVoice("mbrola_us1");

    code> Note: if your voice database name is us1; then you must add it above as "mbrola_us1"; if it is en1 then it should be "mbrola_en1" . This really did the trick for me.


Please find a working example here:


package com.sunriseprojects.freetts.demo;

import java.beans.PropertyVetoException;
import java.util.Locale;

import javax.speech.AudioException;
import javax.speech.Central;
import javax.speech.EngineException;
import javax.speech.EngineStateError;
import javax.speech.synthesis.Synthesizer;
import javax.speech.synthesis.SynthesizerModeDesc;
import javax.speech.synthesis.Voice;

public class SpeechUtils {
	SynthesizerModeDesc desc;
	Synthesizer synthesizer;
	Voice voice;

	public void init(String voiceName) throws EngineException, AudioException,
			EngineStateError, PropertyVetoException {
		if (desc == null) {
//			System.setProperty("freetts.voices",
//					"com.sun.speech.freetts.en.us.cmu_us_kal.KevinVoiceDirectory");
			//have to be setup
			desc = new SynthesizerModeDesc(Locale.US);
			synthesizer = Central.createSynthesizer(desc);
			SynthesizerModeDesc smd = (SynthesizerModeDesc) synthesizer
			Voice[] voices = smd.getVoices();
			Voice voice = null;
			for (int i = 0; i < voices.length; i++) {
				if (voices[i].getName().equals(voiceName)) {
					voice = voices[i];

	public void terminate() throws EngineException, EngineStateError {

	public void doSpeak(String speakText) throws EngineException,
			AudioException, IllegalArgumentException, InterruptedException {
		synthesizer.speakPlainText(speakText, null);

	public static void main(String[] args) throws Exception {
		System.setProperty("mbrola.base", "C:\\lnx1\\home\\ggon\\git-projects\\mbrola");
		SpeechUtils su = new SpeechUtils();
		//have to be setup on your env
		//su.doSpeak("Hello world!");
	final static String SAMPLE = "Wiki said, Floyd Mayweather, Jr. is an American professional boxer. He is currently undefeated as a professional and is a five-division world champion, having won ten world titles and the lineal championship in four different weight classes";

Run codeHide result



All Articles